From 10ba21fbbceb4a9b163947f693f2407663a7ec1a Mon Sep 17 00:00:00 2001 From: tanishq-aggarwal <43620184+tanishq-aggarwal@users.noreply.github.com> Date: Sun, 22 Jun 2025 15:39:33 +0530 Subject: [PATCH] fix: remove unwanted trailing slash when resolving new href In browser extension environments, when using hash mode, resolveNewHref() was appending a trailing slash which gives a "Youre file couldn't be accessed" error when the user directly enters that href in the url bar. Removing the trailing slash fixes that issue. --- src/lib/utils/navigation.utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/utils/navigation.utils.ts b/src/lib/utils/navigation.utils.ts index 00778f1..a75347d 100644 --- a/src/lib/utils/navigation.utils.ts +++ b/src/lib/utils/navigation.utils.ts @@ -85,9 +85,9 @@ export function resolveNewHref(target: string, { const strSearch = search.toString(); if (strSearch) href.hash += `?${strSearch}`; if (trailingHash?.length && !stripTrailingHash) href.hash += `#${trailingHash}`; - if (base) href.pathname = toPathSegment(base, true); + if (base) href.pathname = toPathSegment(base, false); if (href.search && !href.search?.endsWith('/')) href.search += '/'; - if (!href.search?.length && !href.pathname?.endsWith('/')) href.pathname += '/'; + // if (!href.search?.length && !href.pathname?.endsWith('/')) href.pathname += '/'; } else { href.pathname = [base, _target] .filter(Boolean)