From f1f2ea86ebf92f5fbffe98af02406a0b1904a7dd Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Wed, 10 Dec 2025 00:04:34 +0100 Subject: [PATCH] Remove redundant root slash for absolute paths Having an absolute path with two starting slashes can lead to issues with browsers like Tor Browser and sandboxes like AppArmor. The former defaults to https:// if two slashes are supplied. Even though the code explicitly states file://, this can still happen on systems like Linux, because the open functions eventually call gio, which removes the file:// prefix before passing the URI as argument to a program. AppArmor rejects read access even if configuration allows access (configured with one slash), so a contained browser like Firefox, which defaults to file://, could not open the html files. Since paths are already set to absolute paths through dataPath call, this additional slash can be removed in open functions. --- src/gui/MainWindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index d51588ac5..b769c654a 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1195,12 +1195,12 @@ void MainWindow::openBugReportUrl() void MainWindow::openGettingStartedGuide() { - customOpenUrl(QString("file:///%1").arg(resources()->dataPath("docs/KeePassXC_GettingStarted.html"))); + customOpenUrl(QString("file://%1").arg(resources()->dataPath("docs/KeePassXC_GettingStarted.html"))); } void MainWindow::openUserGuide() { - customOpenUrl(QString("file:///%1").arg(resources()->dataPath("docs/KeePassXC_UserGuide.html"))); + customOpenUrl(QString("file://%1").arg(resources()->dataPath("docs/KeePassXC_UserGuide.html"))); } void MainWindow::openOnlineHelp() @@ -1210,7 +1210,7 @@ void MainWindow::openOnlineHelp() void MainWindow::openKeyboardShortcuts() { - customOpenUrl(QString("file:///%1").arg(resources()->dataPath("docs/KeePassXC_KeyboardShortcuts.html"))); + customOpenUrl(QString("file://%1").arg(resources()->dataPath("docs/KeePassXC_KeyboardShortcuts.html"))); } void MainWindow::switchToDatabases()