From 8c7cd6832eaa1d4b5fbf36b62be0d0ce2d6c3482 Mon Sep 17 00:00:00 2001 From: IChengHo <72492494+nasirHo@users.noreply.github.com> Date: Fri, 21 Nov 2025 15:33:29 -0500 Subject: [PATCH] fix(route/phoronix): Use `ofetch` and `parseString` for reliable feed fetching (#20543) The `rss-parser`'s internal `parseURL` method can fail with an "Error: Non-whitespace before first tag" on feeds that are gzipped or contain a Byte Order Mark (BOM), as it lacks robust decompression and encoding handling. This change switches the Phoronix route to: Fetch the raw XML string using `ofetch`, which handles compression and encoding correctly. Pass the resulting clean string to `parser.parseString()`. This resolves the parsing issue and ensures the route is reliable. --- lib/routes/phoronix/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/routes/phoronix/index.ts b/lib/routes/phoronix/index.ts index a923ba33f..0438af8c5 100644 --- a/lib/routes/phoronix/index.ts +++ b/lib/routes/phoronix/index.ts @@ -1,4 +1,5 @@ import { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import cache from '@/utils/cache'; import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; @@ -17,7 +18,8 @@ const baseUrl = 'https://www.phoronix.com'; const rssUrl = `${baseUrl}/rss.php`; const feedFetch = async () => { - const feed = await parser.parseURL(rssUrl); + const feedStr = await ofetch(rssUrl); + const feed = await parser.parseString(feedStr); return { title: feed.title, link: feed.link,