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.
This commit is contained in:
Vladimir Golovnev 2024-10-05 12:27:03 +03:00 committed by Vladimir Golovnev (Glassez)
parent dd7ef8e934
commit 387821267f
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7

View file

@ -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