mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-07 06:27:39 +03:00
Set correct case for database file path on Windows
* Fix #7139 - when opening database files from the command line, ensure the correct case is fed to the program to prevent case changes during saves. * Cleanup old code (checking for .json extension) from when KeePassXC app could act as a proxy.
This commit is contained in:
parent
87cd9c6fb9
commit
31924fcd89
2 changed files with 33 additions and 11 deletions
|
@ -155,11 +155,12 @@ void DatabaseTabWidget::addDatabaseTab(const QString& filePath,
|
|||
const QString& password,
|
||||
const QString& keyfile)
|
||||
{
|
||||
QFileInfo fileInfo(filePath);
|
||||
QString cleanFilePath = QDir::toNativeSeparators(filePath);
|
||||
QFileInfo fileInfo(cleanFilePath);
|
||||
QString canonicalFilePath = fileInfo.canonicalFilePath();
|
||||
|
||||
if (canonicalFilePath.isEmpty()) {
|
||||
emit messageGlobal(tr("Failed to open %1. It either does not exist or is not accessible.").arg(filePath),
|
||||
emit messageGlobal(tr("Failed to open %1. It either does not exist or is not accessible.").arg(cleanFilePath),
|
||||
MessageWidget::Error);
|
||||
return;
|
||||
}
|
||||
|
@ -178,10 +179,10 @@ void DatabaseTabWidget::addDatabaseTab(const QString& filePath,
|
|||
}
|
||||
}
|
||||
|
||||
auto* dbWidget = new DatabaseWidget(QSharedPointer<Database>::create(filePath), this);
|
||||
auto* dbWidget = new DatabaseWidget(QSharedPointer<Database>::create(cleanFilePath), this);
|
||||
addDatabaseTab(dbWidget, inBackground);
|
||||
dbWidget->performUnlockDatabase(password, keyfile);
|
||||
updateLastDatabases(filePath);
|
||||
updateLastDatabases(cleanFilePath);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -782,7 +783,7 @@ void DatabaseTabWidget::updateLastDatabases(const QString& filename)
|
|||
config()->remove(Config::LastDatabases);
|
||||
} else {
|
||||
QStringList lastDatabases = config()->get(Config::LastDatabases).toStringList();
|
||||
lastDatabases.prepend(filename);
|
||||
lastDatabases.prepend(QDir::toNativeSeparators(filename));
|
||||
lastDatabases.removeDuplicates();
|
||||
|
||||
while (lastDatabases.count() > config()->get(Config::NumberOfRememberedLastDatabases).toInt()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue