Chocobo1 2023-10-07 12:28:07 +08:00 committed by GitHub
parent c051ee9409
commit 34f7b75f12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 2 deletions

View file

@ -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()));
}
}
}