mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Avoid double file extension replacement in backup filename
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user