Windows QPA: fix mail launch in case parameter is wrong

Done-with: Ilya Fedin <fedin-ilja2010@ya.ru>
Change-Id: I7b24ed64533cdf26f3f3d7dba4b5e80490be269c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
(cherry picked from commit b3930b03cd6519db068bf0fca45d3e32ff7ce2df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Yuhang Zhao 2023-05-23 17:57:56 +08:00 committed by Qt Cherry-pick Bot
parent 7d042a0d37
commit 7d55bf65fb

View File

@ -154,6 +154,11 @@ static inline bool launchMail(const QUrl &url)
qWarning("Cannot launch '%ls': There is no mail program installed.", qUtf16Printable(url.toString())); qWarning("Cannot launch '%ls': There is no mail program installed.", qUtf16Printable(url.toString()));
return false; return false;
} }
// Fix mail launch if no param is expected in this command.
if (command.indexOf(QStringLiteral("%1")) < 0) {
qWarning() << "The mail command lacks the '%1' parameter.";
return false;
}
//Make sure the path for the process is in quotes //Make sure the path for the process is in quotes
const QChar doubleQuote = u'"'; const QChar doubleQuote = u'"';
if (!command.startsWith(doubleQuote)) { if (!command.startsWith(doubleQuote)) {