From 015950ea612f79004aac7078f6839bf8c120e6cc Mon Sep 17 00:00:00 2001 From: Mark Yu Date: Sun, 14 Sep 2025 04:54:14 -0400 Subject: [PATCH] Allow equals character in the command line value The CLI options should allow the `=` (equals) char as value so doing `--save-path="/home/test/mydir = somedir"` should parse properly with the `value` method returning `"/home/test/mydir = somedir"`. Closes #23248. PR #23251. --------- Co-authored-by: Vladimir Golovnev Co-authored-by: Chocobo1 --- src/app/cmdoptions.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/app/cmdoptions.cpp b/src/app/cmdoptions.cpp index 3cbf53e37..c4159329b 100644 --- a/src/app/cmdoptions.cpp +++ b/src/app/cmdoptions.cpp @@ -147,12 +147,14 @@ namespace QString value(const QString &arg) const { - QStringList parts = arg.split(u'='); - if (parts.size() == 2) - return Utils::String::unquote(parts[1], u"'\""_s); - throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "Parameter '%1' must follow syntax '%1=%2'", + const qsizetype index = arg.indexOf(u'='); + if (index == -1) + throw CommandLineParameterError(QCoreApplication::translate("CMD Options", "Parameter '%1' must follow syntax '%1=%2'", "e.g. Parameter '--webui-port' must follow syntax '--webui-port=value'") .arg(fullParameter(), u""_s)); + + const QStringView val = QStringView(arg).sliced(index + 1); + return Utils::String::unquote(val, u"'\""_s).toString(); } QString value(const QProcessEnvironment &env, const QString &defaultValue = {}) const @@ -168,7 +170,7 @@ namespace friend bool operator==(const StringOption &option, const QString &arg) { - return arg.startsWith(option.parameterAssignment()); + return (arg == option.fullParameter()) || arg.startsWith(option.parameterAssignment()); } private: