fix: /openurl can now open urls with spaces, assuming the url allows it (#5197)

This allows for commands like `/openurl https://www.deepl.com/en/translator#auto/en/{1+}` that previously worked
This commit is contained in:
pajlada 2024-02-24 12:27:24 +01:00 committed by GitHub
parent ffa63f0dc9
commit dcd6179434
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -28,7 +28,7 @@
- Minor: Chatters from recent-messages are now added to autocompletion. (#5116)
- Minor: Added a _System_ theme that updates according to the system's color scheme (requires Qt 6.5). (#5118)
- Minor: Added icons for newer versions of macOS. (#5148)
- Minor: Added the `--incognito/--no-incognito` options to the `/openurl` command, allowing you to override the "Open links in incognito/private mode" setting. (#5149)
- Minor: Added the `--incognito/--no-incognito` options to the `/openurl` command, allowing you to override the "Open links in incognito/private mode" setting. (#5149, #5197)
- Minor: Added support for the `{input.text}` placeholder in the **Split** -> **Run a command** hotkey. (#5130)
- Minor: Add a new Channel API for experimental plugins feature. (#5141, #5184, #5187)
- Minor: Added the ability to change the top-most status of a window regardless of the _Always on top_ setting (right click the notebook). (#5135)

View file

@ -443,6 +443,8 @@ QString openURL(const CommandContext &ctx)
}
QCommandLineParser parser;
parser.setOptionsAfterPositionalArgumentsMode(
QCommandLineParser::ParseAsPositionalArguments);
parser.addPositionalArgument("URL", "The URL to open");
QCommandLineOption privateModeOption(
{
@ -469,7 +471,7 @@ QString openURL(const CommandContext &ctx)
"Usage: /openurl <URL> [--incognito/--no-incognito]"));
return "";
}
auto urlString = parser.positionalArguments().at(0);
auto urlString = parser.positionalArguments().join(' ');
QUrl url = QUrl::fromUserInput(urlString);
if (!url.isValid())