Skip to content

Commit

Permalink
fix(route/dockerhub): hash images (DIYgod#16841)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuomi1 authored Sep 20, 2024
1 parent f10693f commit a9de202
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/routes/dockerhub/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import md5 from '@/utils/md5';

function hash(images) {
const entries = Object.entries(images)
.map((x) => [`${x[1].os}/${x[1].architecture}`, x[1].digest])
.sort((a, b) => a[0] - b[0]);
return md5(entries.map((x) => x.join(',')).join('|'));
.map((x) => `${x[1].os}/${x[1].architecture},${x[1].digest}`)
.sort((a, b) => a.localeCompare(b));
const text = entries.join('|');
return md5(text);
}

export { hash };

0 comments on commit a9de202

Please sign in to comment.