cipher: Fix passphrases containing single quotes

This fixes a regression introduced in d1e3e98006 which makes it
impossible to open encrypted databases with single quote characters in
their passphrase.

See issue #1105.
This commit is contained in:
Martin Kleusberg
2017-09-01 10:12:54 +02:00
parent 516ff44789
commit 5a922fff83

View File

@@ -40,7 +40,7 @@ CipherDialog::KeyFormats CipherDialog::keyFormat() const
QString CipherDialog::password() const
{
if(keyFormat() == KeyFormats::Passphrase)
return QString("'%1'").arg(ui->editPassword->text());
return QString("'%1'").arg(ui->editPassword->text().replace("'", "''"));
else
return QString("\"x'%1'\"").arg(ui->editPassword->text().mid(2)); // Remove the '0x' part at the beginning
}