mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-21 16:00:41 -04:00
Avoid double file extension replacement in backup filename
This commit is contained in:
parent
c13c6ade29
commit
e1558d6300
1 changed files with 2 additions and 1 deletions
|
@ -570,10 +570,11 @@ QString Database::writeDatabase(QIODevice* device)
|
||||||
* @param filePath Path to the file to backup
|
* @param filePath Path to the file to backup
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Database::backupDatabase(QString filePath)
|
bool Database::backupDatabase(QString filePath)
|
||||||
{
|
{
|
||||||
QString backupFilePath = filePath;
|
QString backupFilePath = filePath;
|
||||||
auto re = QRegularExpression("(?:\\.kdbx)?$", QRegularExpression::CaseInsensitiveOption);
|
auto re = QRegularExpression("\\.kdbx$|(?<!\\.kdbx)$", QRegularExpression::CaseInsensitiveOption);
|
||||||
backupFilePath.replace(re, ".old.kdbx");
|
backupFilePath.replace(re, ".old.kdbx");
|
||||||
QFile::remove(backupFilePath);
|
QFile::remove(backupFilePath);
|
||||||
return QFile::copy(filePath, backupFilePath);
|
return QFile::copy(filePath, backupFilePath);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue