From 48237abdb35019568d16ed3256814bc6a0ca0acd Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 5 Feb 2024 19:12:21 +0100 Subject: [PATCH] fix(withFragment): use `encodeHash` for encoding --- src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index d82e4ec9..849c0aa8 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -301,7 +301,7 @@ export function isEqual(a: string, b: string, options: CompareURLOptions = {}) { export function withFragment(input: string, hash: string): string { const parsed = parseURL(input); - parsed.hash = hash === "" ? "" : "#" + encodeURI(hash); + parsed.hash = hash === "" ? "" : "#" + encodeHash(hash); return stringifyParsedURL(parsed); }