From b6b697cabdb296d2c1b5b0a3e92afa4da62d22ee Mon Sep 17 00:00:00 2001 From: Manuel <30572287+manuel-rw@users.noreply.github.com> Date: Fri, 29 Dec 2023 10:55:59 +0100 Subject: [PATCH] fix: umlaute in RSS (#1755) --- src/server/api/routers/rss.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/server/api/routers/rss.ts b/src/server/api/routers/rss.ts index 83f3077684e..02bc618b7e6 100644 --- a/src/server/api/routers/rss.ts +++ b/src/server/api/routers/rss.ts @@ -39,10 +39,10 @@ const rssFeedResultObjectSchema = z title: z.string(), content: z.string(), pubDate: z.string().optional(), - }) + }), ), }), - }) + }), ); export const rssRouter = createTRPCRouter({ @@ -52,7 +52,7 @@ export const rssRouter = createTRPCRouter({ widgetId: z.string().uuid(), feedUrls: z.array(z.string()), configName: z.string(), - }) + }), ) .output(z.array(rssFeedResultObjectSchema)) .query(async ({ input }) => { @@ -75,8 +75,8 @@ export const rssRouter = createTRPCRouter({ const result = await Promise.all( input.feedUrls.map(async (feedUrl) => - getFeedUrl(feedUrl, rssWidget.properties.dangerousAllowSanitizedItemContent) - ) + getFeedUrl(feedUrl, rssWidget.properties.dangerousAllowSanitizedItemContent), + ), ); return result; @@ -106,11 +106,11 @@ const getFeedUrl = async (feedUrl: string, dangerousAllowSanitizedItemContent: b title: item.title ? decode(item.title) : undefined, content: processItemContent( item['content:encoded'] ?? item.content, - dangerousAllowSanitizedItemContent + dangerousAllowSanitizedItemContent, ), enclosure: createEnclosure(item), link: createLink(item), - }) + }), ) .sort((a: { pubDate: number }, b: { pubDate: number }) => { if (!a.pubDate || !b.pubDate) { @@ -159,7 +159,9 @@ const processItemContent = (content: string, dangerousAllowSanitizedItemContent: }); } - return encode(content); + return encode(content, { + level: "html5" + }); }; const createLink = (item: any) => {