Fix #4233: 修复 RemoteMod::getIntegrityCheck 未选择正确的算法的问题 (#4238)

This commit is contained in:
Glavo
2025-08-10 15:39:13 +08:00
committed by GitHub
parent f521a041a9
commit 80f1367d9a

View File

@@ -300,11 +300,13 @@ public final class RemoteMod {
public FileDownloadTask.IntegrityCheck getIntegrityCheck() { public FileDownloadTask.IntegrityCheck getIntegrityCheck() {
if (hashes.containsKey("md5")) { if (hashes.containsKey("md5")) {
return new FileDownloadTask.IntegrityCheck("MD5", hashes.get("sha1")); return new FileDownloadTask.IntegrityCheck("MD5", hashes.get("md5"));
} else if (hashes.containsKey("sha1")) { } else if (hashes.containsKey("sha1")) {
return new FileDownloadTask.IntegrityCheck("SHA-1", hashes.get("sha1")); return new FileDownloadTask.IntegrityCheck("SHA-1", hashes.get("sha1"));
} else if (hashes.containsKey("sha256")) {
return new FileDownloadTask.IntegrityCheck("SHA-256", hashes.get("sha256"));
} else if (hashes.containsKey("sha512")) { } else if (hashes.containsKey("sha512")) {
return new FileDownloadTask.IntegrityCheck("SHA-256", hashes.get("sha1")); return new FileDownloadTask.IntegrityCheck("SHA-512", hashes.get("sha512"));
} else { } else {
return null; return null;
} }