We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 50929bb commit 306de36Copy full SHA for 306de36
1 file changed
lib/util/url.ts
@@ -26,10 +26,11 @@ export const parse = (u: string | URL) => new URL(u);
26
* @returns
27
*/
28
export function resolve(from: string, to: string) {
29
- const fromUrl = new URL(convertPathToPosix(from), "resolve://");
+ // we use a non-existent URL to check if its a relative URL
30
+ const fromUrl = new URL(convertPathToPosix(from), "https://aaa.nonexistanturl.com");
31
const resolvedUrl = new URL(convertPathToPosix(to), fromUrl);
32
const endSpaces = to.match(/(\s*)$/)?.[1] || "";
- if (resolvedUrl.protocol === "resolve:") {
33
+ if (resolvedUrl.hostname === "aaa.nonexistanturl.com") {
34
// `from` is a relative URL.
35
const { pathname, search, hash } = resolvedUrl;
36
return pathname + search + hash + endSpaces;
0 commit comments