Skip to content

Commit 72bb5ad

Browse files
committed
fix url decoding limit
1 parent 6f26d9b commit 72bb5ad

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/util/url.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export function resolve(from: string, to: string) {
3737
}
3838
const resolved = resolvedUrl.toString() + endSpaces;
3939
// if there is a #, we want to split on the first one only, and decode the part after
40-
if (resolved.indexOf("#") >= 0) {
41-
const [base, hash] = resolved.split(/#(.+)/);
42-
return base + "#" + decodeURIComponent(hash);
40+
if (resolved.includes("#")) {
41+
const [base, hash] = resolved.split("#", 2);
42+
return base + "#" + decodeURIComponent(hash || "");
4343
}
4444
return resolved;
4545
}

0 commit comments

Comments
 (0)