diff --git a/src/utils/path.ts b/src/utils/path.ts index dfd7e679b6..bc4a2885cf 100644 --- a/src/utils/path.ts +++ b/src/utils/path.ts @@ -41,14 +41,13 @@ export const encodePath = (path: string, all?: boolean) => { return path .split("/") .map((p) => - // ["#", "?", "%"].some((c) => p.includes(c)) ? encodeURIComponent(p) : p all ? encodeURIComponent(p) : p - .replaceAll("%", "%25") - .replaceAll("?", "%3F") - .replaceAll("#", "%23") - .replaceAll(" ", "%20"), + .replace(/%/g, "%25") + .replace(/\?/g, "%3F") + .replace(/#/g, "%23") + .replace(/ /g, "%20"), ) .join("/") }