Archived
1
0

Remove leading slash trim in base resolver

It's not necessary since we return early if the path starts with a
slash.
This commit is contained in:
Asher 2020-08-05 12:47:37 -05:00
parent 543d64268d
commit 10c2b956ac
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -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)