From 6ba1cf6ca396f0c5547f2b6f84f613cd72a730c0 Mon Sep 17 00:00:00 2001 From: askepticaldreamer <106888785+askepticaldreamer@users.noreply.github.com> Date: Thu, 19 Jan 2023 00:03:35 -0800 Subject: [PATCH] Fix slash to backslash conversions in url hashes for opening links in incognito (#4307) * Pass link as argument instead of in command string when opening incognito links * Update CHANGELOG.md * Make changelog message more user facing * Remove now unused argument for getCommand --- CHANGELOG.md | 1 + src/util/IncognitoBrowser.cpp | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15238f70a..228298c7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - Bugfix: Fixed crash that could occur when closing down a split at the wrong time. (#4277) - Bugfix: Fixed crash that could occur when closing down the last of a channel when reloading emotes. (#4278) - Bugfix: Fixed scrollbar highlight colors when changing message history limit. (#4288) +- Bugfix: Fixed an issue on Windows when opening links in incognito mode that contained forward slashes in hash (#4307) - Dev: Remove protocol from QApplication's Organization Domain (so changed from `https://www.chatterino.com` to `chatterino.com`). (#4256) - Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198) - Dev: Migrated to C++ 20 (#4252, #4257) diff --git a/src/util/IncognitoBrowser.cpp b/src/util/IncognitoBrowser.cpp index 377a68918..0092d3284 100644 --- a/src/util/IncognitoBrowser.cpp +++ b/src/util/IncognitoBrowser.cpp @@ -45,7 +45,7 @@ QString injectPrivateSwitch(QString command) return QString(); } -QString getCommand(const QString &link) +QString getCommand() { // get default browser prog id auto browserId = QSettings("HKEY_CURRENT_" @@ -74,9 +74,6 @@ QString getCommand(const QString &link) return QString(); } - // link - command += " " + link; - return command; } #endif @@ -88,7 +85,7 @@ namespace chatterino { bool supportsIncognitoLinks() { #ifdef Q_OS_WIN - return !getCommand("").isNull(); + return !getCommand().isNull(); #else return false; #endif @@ -97,10 +94,10 @@ bool supportsIncognitoLinks() bool openLinkIncognito(const QString &link) { #ifdef Q_OS_WIN - auto command = getCommand(link); + auto command = getCommand(); // TODO: split command into program path and incognito argument - return QProcess::startDetached(command, {}); + return QProcess::startDetached(command, {link}); #else return false; #endif