diff --git a/src/utils.ts b/src/utils.ts index fafa927d..ffe91e64 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -14,6 +14,7 @@ const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/; const PROTOCOL_SCRIPT_RE = /^[\s\0]*(blob|data|javascript|vbscript):$/i; const TRAILING_SLASH_RE = /\/$|\/\?|\/#/; const JOIN_LEADING_SLASH_RE = /^\.?\//; +const JOIN_SEGMENT_SPLIT_RE = /(? { @@ -42,6 +46,10 @@ describe("joinRelativeURL", () => { { input: ["../a", "../../../b"], out: "../../b" }, { input: ["../a", "../../../../b"], out: "../../../b" }, { input: ["../a/", "../b"], out: "b" }, + { + input: ["https://google.com/", "../foo"], + out: "https://google.com/foo", + }, ]; for (const t of relativeTests) {