Ensure invalid checksums arent used.

This commit is contained in:
Daniel Scalzi
2020-05-30 01:26:39 -04:00
parent 407032df61
commit 6e94883f23

View File

@@ -116,7 +116,7 @@ export class ForgeGradle2Adapter extends ForgeResolver {
libBuf = await readFile(localPath) libBuf = await readFile(localPath)
// VERIFY HASH // VERIFY HASH
if (!postProcess) { // Checksums for .pack.xz in the version.json are completely useless. if (!postProcess) { // Checksums for .pack.xz in the version.json are completely useless.
if (lib.checksums != null) { if (lib.checksums != null && lib.checksums.length == 1) {
const sha1 = createHash('sha1').update(libBuf).digest('hex') const sha1 = createHash('sha1').update(libBuf).digest('hex')
if (sha1 !== lib.checksums[0]) { if (sha1 !== lib.checksums[0]) {
console.debug('Hashes do not match, redownloading..') console.debug('Hashes do not match, redownloading..')