Mark files as being downloaded from the web on Windows

This commit is contained in:
Nicolas Werner 2024-09-09 23:15:45 +02:00
parent 3b41d20506
commit b37909a2c8
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
6 changed files with 25 additions and 3 deletions

View file

@ -13,6 +13,7 @@
#include <QBuffer>
#include <QComboBox>
#include <QCryptographicHash>
#include <QFile>
#include <QGuiApplication>
#include <QImageReader>
#include <QProcessEnvironment>
@ -2230,3 +2231,18 @@ utils::parseMatrixUri(QString uri)
.vias = std::move(vias),
};
}
void
utils::markFileAsFromWeb(const QString &path [[maybe_unused]])
{
#ifdef Q_OS_WINDOWS
QFile file(path + ":Zone.Identifier");
if (!file.open(QIODevice::Truncate | QIODevice::WriteOnly)) {
nhlog::net()->error("Failed to open alternate stream for {}", path.toStdString());
return;
}
file.write("[ZoneTransfer]\nZoneId=3");
file.close();
#endif
}