From 5c7a6ab1a4def2e9d236227b8bbe384fac2d4b0a Mon Sep 17 00:00:00 2001 From: Matt Walsh Date: Fri, 11 Jul 2025 22:36:47 -0500 Subject: [PATCH] fix for rss feed encoding types close #124 --- server/scripts/modules/custom-rss-feed.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/scripts/modules/custom-rss-feed.mjs b/server/scripts/modules/custom-rss-feed.mjs index 059f8e6..64890d8 100644 --- a/server/scripts/modules/custom-rss-feed.mjs +++ b/server/scripts/modules/custom-rss-feed.mjs @@ -64,9 +64,11 @@ const getFeed = async (url) => { // this returns a data url // a few sanity checks if (rssResponse.status.content_type.indexOf('xml') < 0) return; - if (rssResponse.contents.indexOf('base64') > 100) return; + // determine return type + const isBase64 = rssResponse.status.content_type.substring(0, 8) !== 'text/xml'; + // base 64 decode everything after the comma - const rss = atob(rssResponse.contents.split('base64,')[1]); + const rss = isBase64 ? atob(rssResponse.contents.split('base64,')[1]) : rssResponse.contents; // parse the rss const doc = parser.parseFromString(rss, 'text/xml');