diff --git a/lib/routes/dockerhub/tag.ts b/lib/routes/dockerhub/tag.ts index bcb448f2ab86cd..3bcb297fcd0638 100644 --- a/lib/routes/dockerhub/tag.ts +++ b/lib/routes/dockerhub/tag.ts @@ -17,7 +17,7 @@ export const route: Route = { supportScihub: false, }, name: 'Image New Tag', - maintainers: [], + maintainers: ['pseudoyu'], handler, description: `:::warning Use \`library\` as the \`owner\` for official images, such as [https://rsshub.app/dockerhub/tag/library/mysql](https://rsshub.app/dockerhub/tag/library/mysql) @@ -42,14 +42,20 @@ async function handler(ctx) { description: metadata.data.description, link, language: 'en', - item: tags.map((item) => ({ - title: `${namespace}:${item.name} was updated`, - description: `${namespace}:${item.name} was updated, supporting the architectures of ${item.images.map((img) => `${img.os}/${img.architecture}`).join(', ')}`, - link: `https://hub.docker.com/layers/${owner === 'library' ? `${image}/` : ''}${namespace}/${item.name}/images/${item.images[0].digest.replace(':', '-')}`, - author: owner, - pubDate: parseDate(item.tag_last_pushed), - // check for (1) different tag names and (2) different image hashes, considering varients of all arches - guid: `${namespace}:${item.name}@${hash(item.images)}`, - })), + item: tags.map((item) => { + const architectures = item.images?.length ? item.images.map((img) => `${img.os}/${img.architecture}`).join(', ') : 'unknown architectures'; + + const imageDigest = item.digest?.replace(':', '-') || ''; + const layerLink = `https://hub.docker.com/layers/${owner === 'library' ? `${image}/` : ''}${namespace}/${item.name}/images/${imageDigest}`; + + return { + title: `${namespace}:${item.name} was updated`, + description: `${namespace}:${item.name} was updated, supporting the ${architectures}`, + link: layerLink, + author: owner, + pubDate: parseDate(item.tag_last_pushed), + guid: `${namespace}:${item.name}@${hash(item.images || [])}`, + }; + }), }; }