mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-01 07:25:34 +00:00
Verify mod hash after downloading
This commit is contained in:
parent
e216b6ec06
commit
25a1061700
@ -571,11 +571,16 @@ void NewSyncResources(SOCKET Sock, const std::string& Mods, const std::vector<Mo
|
||||
OutFile.write(DownloadedFile.data(), DownloadedFile.size());
|
||||
OutFile.flush();
|
||||
}
|
||||
// 2. verify size
|
||||
// 2. verify size and hash
|
||||
if (std::filesystem::file_size(PathToSaveTo) != DownloadedFile.size()) {
|
||||
error("Failed to write the entire file '" + PathToSaveTo + "' correctly (file size mismatch)");
|
||||
Terminate = true;
|
||||
}
|
||||
|
||||
if (GetSha256HashReallyFast(PathToSaveTo) != ModInfoIter->Hash) {
|
||||
error("Failed to write or download the entire file '" + PathToSaveTo + "' correctly (hash mismatch)");
|
||||
Terminate = true;
|
||||
}
|
||||
} while (fs::file_size(PathToSaveTo) != ModInfoIter->FileSize && !Terminate);
|
||||
if (!Terminate) {
|
||||
if (!fs::exists(GetGamePath() + "mods/multiplayer")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user