mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Avoid double file extension replacement in backup filename
This commit is contained in:
parent
c13c6ade29
commit
e1558d6300
@ -570,10 +570,11 @@ QString Database::writeDatabase(QIODevice* device)
|
||||
* @param filePath Path to the file to backup
|
||||
* @return
|
||||
*/
|
||||
|
||||
bool Database::backupDatabase(QString filePath)
|
||||
{
|
||||
QString backupFilePath = filePath;
|
||||
auto re = QRegularExpression("(?:\\.kdbx)?$", QRegularExpression::CaseInsensitiveOption);
|
||||
auto re = QRegularExpression("\\.kdbx$|(?<!\\.kdbx)$", QRegularExpression::CaseInsensitiveOption);
|
||||
backupFilePath.replace(re, ".old.kdbx");
|
||||
QFile::remove(backupFilePath);
|
||||
return QFile::copy(filePath, backupFilePath);
|
||||
|
Loading…
Reference in New Issue
Block a user