From 14f76a96e8c25caa9f1cd278f4799e4ad37e2bb4 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 14 Sep 2023 10:53:05 +0000 Subject: [PATCH] fetch-yarn-deps: warn on undefined expected hash instead of rejecting, given that the expected hash may not be known/provided. --- pkgs/build-support/node/fetch-yarn-deps/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/node/fetch-yarn-deps/index.js b/pkgs/build-support/node/fetch-yarn-deps/index.js index 04f47362b10d..de2a09ee9041 100755 --- a/pkgs/build-support/node/fetch-yarn-deps/index.js +++ b/pkgs/build-support/node/fetch-yarn-deps/index.js @@ -37,7 +37,9 @@ const downloadFileHttps = (fileName, url, expectedHash, hashType = 'sha1') => { res.on('end', () => { file.close() const h = hash.read() - if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h}`)) + if (expectedHash === undefined){ + console.log(`Warning: lockfile url ${url} doesn't end in "#" to validate against. Downloaded file had hash ${h}.`); + } else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h}`)) resolve() }) res.on('error', e => reject(e))