From 4aeac64ecd82d5953bdb92916248f5f7352be4f4 Mon Sep 17 00:00:00 2001 From: Marcos Casagrande Date: Mon, 13 Jul 2020 06:53:36 +0200 Subject: fix(cli/fetch): fix relative redirect (#6715) --- cli/js/web/fetch.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'cli/js/web') diff --git a/cli/js/web/fetch.ts b/cli/js/web/fetch.ts index 543560c8d..d692b83e1 100644 --- a/cli/js/web/fetch.ts +++ b/cli/js/web/fetch.ts @@ -342,11 +342,7 @@ export async function fetch( !redirectUrl.startsWith("http://") && !redirectUrl.startsWith("https://") ) { - redirectUrl = - url.split("//")[0] + - "//" + - url.split("//")[1].split("/")[0] + - redirectUrl; // TODO: handle relative redirection more gracefully + redirectUrl = new URL(redirectUrl, url).href; } url = redirectUrl; redirected = true; -- cgit v1.2.3