Skip to content
This repository was archived by the owner on Feb 22, 2026. It is now read-only.

Commit 5c7a6ab

Browse files
committed
fix for rss feed encoding types close vbguyny#124
1 parent 4b63328 commit 5c7a6ab

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/scripts/modules/custom-rss-feed.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ const getFeed = async (url) => {
6464
// this returns a data url
6565
// a few sanity checks
6666
if (rssResponse.status.content_type.indexOf('xml') < 0) return;
67-
if (rssResponse.contents.indexOf('base64') > 100) return;
67+
// determine return type
68+
const isBase64 = rssResponse.status.content_type.substring(0, 8) !== 'text/xml';
69+
6870
// base 64 decode everything after the comma
69-
const rss = atob(rssResponse.contents.split('base64,')[1]);
71+
const rss = isBase64 ? atob(rssResponse.contents.split('base64,')[1]) : rssResponse.contents;
7072

7173
// parse the rss
7274
const doc = parser.parseFromString(rss, 'text/xml');

0 commit comments

Comments
 (0)