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 GitHub
parent e75bcbed6d
commit 3fb5d7764c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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