Skip to content

Commit

Permalink
fix: clean github activity output (#16586)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban authored Aug 31, 2024
1 parent 83da7c5 commit a9caa10
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/routes/github/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Route, ViewType } from '@/types';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
import Parser from 'rss-parser';
import sanitizeHtml from 'sanitize-html';

const parser = new Parser();

Expand Down Expand Up @@ -44,7 +45,7 @@ export const route: Route = {
item: feed.items.map((item) => ({
title: item.title ?? '',
link: item.link,
description: item.content?.replace(/href="(.+?)"/g, `href="https://github.com$1"`),
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,
Expand Down

0 comments on commit a9caa10

Please sign in to comment.