mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 17:53:08 -07: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:
parent
c051ee9409
commit
34f7b75f12
4 changed files with 56 additions and 2 deletions
|
@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue