From 72371a970bc6e0f750a98a3829b59ae86f920be9 Mon Sep 17 00:00:00 2001 From: Zdroba <72391375+DariusZdroba@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:57:21 +0200 Subject: [PATCH] fix: force cli download if checksum fails (#566) --- src/snyk/common/services/downloadService.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/snyk/common/services/downloadService.ts b/src/snyk/common/services/downloadService.ts index 9d30706ba..b7e547a3b 100644 --- a/src/snyk/common/services/downloadService.ts +++ b/src/snyk/common/services/downloadService.ts @@ -115,10 +115,15 @@ export class DownloadService { return true; } // Update is available if fetched checksum not matching the current one - const checksum = await Checksum.getChecksumOf(path, latestChecksum); - if (checksum.verify()) { - this.logger.info(messages.isLatest); - return false; + try { + const checksum = await Checksum.getChecksumOf(path, latestChecksum); + if (checksum.verify()) { + this.logger.info(messages.isLatest); + return false; + } + } catch { + // if checksum check fails; force an update + return true; } return true;