Skip to content

Commit fb49854

Browse files
committed
add end spaces in all scenarios
1 parent 5db51d8 commit fb49854

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/util/url.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ export const parse = (u: string | URL) => new URL(u);
2828
export function resolve(from: string, to: string) {
2929
const fromUrl = new URL(convertPathToPosix(from), "resolve://");
3030
const resolvedUrl = new URL(convertPathToPosix(to), fromUrl);
31+
const endSpaces = to.match(/(\s*)$/)?.[1] || "";
3132
if (resolvedUrl.protocol === "resolve:") {
3233
// `from` is a relative URL.
3334
const { pathname, search, hash } = resolvedUrl;
34-
const endSpaces = to.match(/(\s*)$/)?.[1] || "";
35-
3635
return pathname + search + hash + endSpaces;
3736
}
38-
return resolvedUrl.toString();
37+
return resolvedUrl.toString() + endSpaces;
3938
}
4039

4140
/**

0 commit comments

Comments
 (0)