mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-31 04:38:04 -06:00
Add support for Mark-of-the-Web
https://redcanary.com/threat-detection-report/techniques/mark-of-the-web-bypass/ https://mikehadlow.blogspot.com/2011/07/detecting-and-changing-files-internet.html https://textslashplain.com/2016/04/04/downloads-and-the-mark-of-the-web/ Closes #19648. PR #19675.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "downloadhandlerimpl.h"
|
||||
|
||||
#include <QtSystemDetection>
|
||||
#include <QTemporaryFile>
|
||||
#include <QUrl>
|
||||
|
||||
@@ -146,17 +147,33 @@ void Net::DownloadHandlerImpl::processFinishedDownload()
|
||||
{
|
||||
const nonstd::expected<Path, QString> result = saveToTempFile(m_result.data);
|
||||
if (result)
|
||||
{
|
||||
m_result.filePath = result.value();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
Utils::Misc::applyMarkOfTheWeb(m_result.filePath, m_result.url);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
setError(tr("I/O Error: %1").arg(result.error()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const nonstd::expected<void, QString> result = Utils::IO::saveToFile(destinationPath, m_result.data);
|
||||
if (result)
|
||||
{
|
||||
m_result.filePath = destinationPath;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
Utils::Misc::applyMarkOfTheWeb(m_result.filePath, m_result.url);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
setError(tr("I/O Error: %1").arg(result.error()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user