From 10c2b956ac7db27c5096710dd0757f8e53854ce9 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 5 Aug 2020 12:47:37 -0500 Subject: [PATCH] Remove leading slash trim in base resolver It's not necessary since we return early if the path starts with a slash. --- src/common/util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/util.ts b/src/common/util.ts index 6b9e934e..f0d74582 100644 --- a/src/common/util.ts +++ b/src/common/util.ts @@ -48,7 +48,7 @@ export const resolveBase = (base?: string): string => { if (!base || base.startsWith("/")) { return base || "" } - const parts = location.pathname.replace(/^\//g, "").split("/") + const parts = location.pathname.split("/") parts[parts.length - 1] = base const url = new URL(location.origin + "/" + parts.join("/")) return normalize(url.pathname)