Fix unreachable setting of file permissions (#6514)

Fixes #6080
This commit is contained in:
Xavier Valls 2021-05-15 15:11:19 +02:00 committed by GitHub
parent ee92b980bb
commit e1c8304c4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -486,8 +486,9 @@ bool Database::restoreDatabase(const QString& filePath)
// Only try to restore if the backup file actually exists
if (QFile::exists(backupFilePath)) {
QFile::remove(filePath);
return QFile::copy(backupFilePath, filePath);
QFile::setPermissions(filePath, perms);
if (QFile::copy(backupFilePath, filePath)) {
return QFile::setPermissions(filePath, perms);
}
}
return false;
}