Skip to content

Commit

Permalink
Don't try to apply Mark-of-the-Web to nonexistent files
Browse files Browse the repository at this point in the history
Trying to apply it to a nonexistent file is unacceptable, as it may unexpectedly create such a file.

Closes qbittorrent#21440.
  • Loading branch information
glassez committed Oct 3, 2024
1 parent b5b34c9 commit 1f2faee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/base/utils/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1f2faee

Please sign in to comment.