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

This commit is contained in:
nuomi1
2024-09-21 00:49:42 +08:00
committed by GitHub
parent f10693f0c0
commit a9de2028db
+4 -3
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 };