From 7d55bf65fbccd81d76a7b0aa534aaea5954846ae Mon Sep 17 00:00:00 2001 From: Yuhang Zhao Date: Tue, 23 May 2023 17:57:56 +0800 Subject: [PATCH] Windows QPA: fix mail launch in case parameter is wrong MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Done-with: Ilya Fedin Change-Id: I7b24ed64533cdf26f3f3d7dba4b5e80490be269c Reviewed-by: Oliver Wolff Reviewed-by: Timothée Keller (cherry picked from commit b3930b03cd6519db068bf0fca45d3e32ff7ce2df) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/windows/qwindowsservices.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index d9bb76d10a5..491ae8bbc87 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -154,6 +154,11 @@ static inline bool launchMail(const QUrl &url) qWarning("Cannot launch '%ls': There is no mail program installed.", qUtf16Printable(url.toString())); 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 const QChar doubleQuote = u'"'; if (!command.startsWith(doubleQuote)) {