From a5ec0249f850147f0edd27e72f2f323af91c9566 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 1 Feb 2024 00:39:25 -0800 Subject: [PATCH] Fix utf-8 decoding --- src/utils/proxy/cached-fetch.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/proxy/cached-fetch.js b/src/utils/proxy/cached-fetch.js index 0ed39562..30b00f77 100644 --- a/src/utils/proxy/cached-fetch.js +++ b/src/utils/proxy/cached-fetch.js @@ -12,7 +12,8 @@ export default async function cachedFetch(url, duration) { return cached; } - const data = await fetch(url).then((res) => res.json()); + // wrapping text in JSON.parse to handle utf-8 issues + const data = JSON.parse(await fetch(url).then((res) => res.text())); cache.put(url, data, duration * 1000 * 60); return data; }