fix(github activity): only replace relative link (#16667)

This commit is contained in:
Stephen Zhou
2024-09-09 10:57:37 +08:00
committed by GitHub
parent 28f2d3e19e
commit 1ec2dd0bdf
+1 -1
View File
@@ -45,7 +45,7 @@ export const route: Route = {
item: feed.items.map((item) => ({
title: item.title ?? '',
link: item.link,
description: sanitizeHtml(item.content?.replace(/href="(.+?)"/g, `href="https://github.com$1"`) ?? '', { allowedTags: [...sanitizeHtml.defaults.allowedTags, 'img'] }),
description: sanitizeHtml(item.content?.replace(/href="\/(.+?)"/g, `href="https://github.com/$1"`) ?? '', { allowedTags: [...sanitizeHtml.defaults.allowedTags, 'img'] }),
pubDate: item.pubDate ? parseDate(item.pubDate) : undefined,
author: item.author,
guid: item.id,