Skip to content

Commit

Permalink
Skip check if extract hash from url are failed
Browse files Browse the repository at this point in the history
  • Loading branch information
lifegpc committed Jun 6, 2024
1 parent b7df7ba commit e59716f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tasks/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,20 @@ export async function download_task(
}
if (manager.cfg.check_file_hash) {
const url = re.url;
const hash = getHashFromUrl(url);
const fhash = await calFileSha1(path);
if (hash != fhash) {
console.warn(
`Hash not matched: file hash ${fhash}, original hash ${hash}, url ${url}`,
);
throw new HashError();
let hash: string | null = null;
try {
hash = getHashFromUrl(url);
} catch (e) {
console.warn(e);
}
if (hash) {
const fhash = await calFileSha1(path);
if (hash != fhash) {
console.warn(
`Hash not matched: file hash ${fhash}, original hash ${hash}, url ${url}`,
);
throw new HashError();
}
}
}
}
Expand Down

0 comments on commit e59716f

Please sign in to comment.