fix(route/dockerhub): hash images (#16841)

This commit is contained in:
nuomi1 2024-09-21 01:49:42 +09:00 committed by GitHub
parent f10693f0c0
commit a9de2028db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -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 };