Technic: Verify checksums for pack build mods

This commit is contained in:
Jamie Mansfield 2022-04-02 00:11:33 +01:00
parent a232c2d509
commit 7f2615b2a5
No known key found for this signature in database
GPG Key ID: 36F61598F39F67B0

View File

@ -42,6 +42,7 @@
#include "TechnicPackProcessor.h" #include "TechnicPackProcessor.h"
#include "SolderPackManifest.h" #include "SolderPackManifest.h"
#include "net/ChecksumValidator.h"
Technic::SolderPackInstallTask::SolderPackInstallTask( Technic::SolderPackInstallTask::SolderPackInstallTask(
shared_qobject_ptr<QNetworkAccessManager> network, shared_qobject_ptr<QNetworkAccessManager> network,
@ -110,7 +111,14 @@ void Technic::SolderPackInstallTask::fileListSucceeded()
int i = 0; int i = 0;
for (const auto &mod : build.mods) { for (const auto &mod : build.mods) {
auto path = FS::PathCombine(m_outputDir.path(), QString("%1").arg(i)); auto path = FS::PathCombine(m_outputDir.path(), QString("%1").arg(i));
m_filesNetJob->addNetAction(Net::Download::makeFile(mod.url, path));
auto dl = Net::Download::makeFile(mod.url, path);
if (!mod.md5.isEmpty()) {
auto rawMd5 = QByteArray::fromHex(mod.md5.toLatin1());
dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Md5, rawMd5));
}
m_filesNetJob->addNetAction(dl);
i++; i++;
} }