Skip to content

Commit

Permalink
fix: force cli download if checksum fails (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusZdroba authored Dec 20, 2024
1 parent 8a03f1f commit 72371a9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/snyk/common/services/downloadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 72371a9

Please sign in to comment.