From fb49854de4670bd3ef0b74c31c1a1f95fa4ad703 Mon Sep 17 00:00:00 2001 From: JonLuca DeCaro Date: Tue, 5 Mar 2024 23:23:37 -0800 Subject: [PATCH] add end spaces in all scenarios --- lib/util/url.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/util/url.ts b/lib/util/url.ts index 9ab7e99c..8eb7de22 100644 --- a/lib/util/url.ts +++ b/lib/util/url.ts @@ -28,14 +28,13 @@ export const parse = (u: string | URL) => new URL(u); export function resolve(from: string, to: string) { const fromUrl = new URL(convertPathToPosix(from), "resolve://"); const resolvedUrl = new URL(convertPathToPosix(to), fromUrl); + const endSpaces = to.match(/(\s*)$/)?.[1] || ""; if (resolvedUrl.protocol === "resolve:") { // `from` is a relative URL. const { pathname, search, hash } = resolvedUrl; - const endSpaces = to.match(/(\s*)$/)?.[1] || ""; - return pathname + search + hash + endSpaces; } - return resolvedUrl.toString(); + return resolvedUrl.toString() + endSpaces; } /**