From 1ddd528bd73a3a03f242bf13069433cd352ef26b Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 1 Feb 2024 00:42:22 -0800 Subject: [PATCH] Fix quick launch not opening with accented characters, decoding of characters in suggestions (#2802) --- src/pages/index.jsx | 5 ++++- src/utils/proxy/cached-fetch.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/index.jsx b/src/pages/index.jsx index ac03afe3c..59a2ad128 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -224,7 +224,10 @@ function Home({ initialSettings }) { function handleKeyDown(e) { if (e.target.tagName === "BODY" || e.target.id === "inner_wrapper") { if ( - (e.key.length === 1 && e.key.match(/(\w|\s)/g) && !(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) || + (e.key.length === 1 && + e.key.match(/(\w|\s|[à-ü]|[À-Ü])/g) && + !(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) || + e.key.match(/([à-ü]|[À-Ü])/g) || // accented characters may require modifier keys (e.key === "v" && (e.ctrlKey || e.metaKey)) ) { setSearching(true); diff --git a/src/utils/proxy/cached-fetch.js b/src/utils/proxy/cached-fetch.js index 0ed39562f..30b00f77e 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; }