From 3fb5d7764cfc65ab818375e69f2bf82a6993ad1b Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Sat, 5 Oct 2024 12:27:03 +0300 Subject: [PATCH] Don't try to apply Mark-of-the-Web to nonexistent files Trying to apply it to a nonexistent file is unacceptable, as it may unexpectedly create such a file. PR #21488. Closes #21440. --- src/base/utils/os.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/base/utils/os.cpp b/src/base/utils/os.cpp index 8bfd7d07e..ee542e48e 100644 --- a/src/base/utils/os.cpp +++ b/src/base/utils/os.cpp @@ -271,6 +271,11 @@ Path Utils::OS::windowsSystemPath() #if defined(Q_OS_MACOS) || defined(Q_OS_WIN) bool Utils::OS::applyMarkOfTheWeb(const Path &file, const QString &url) { + // Trying to apply this to a non-existent file is unacceptable, + // as it may unexpectedly create such a file. + if (!file.exists()) + return false; + Q_ASSERT(url.isEmpty() || url.startsWith(u"http:") || url.startsWith(u"https:")); #ifdef Q_OS_MACOS