summaryrefslogtreecommitdiff
path: root/cli/js
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2020-07-13 06:53:36 +0200
committerGitHub <noreply@github.com>2020-07-13 00:53:36 -0400
commit4aeac64ecd82d5953bdb92916248f5f7352be4f4 (patch)
tree902111fada801eafc41141d68d865e1ce0ccafa9 /cli/js
parentac000341db0c90012a6330f66bd7bebe44c9c872 (diff)
fix(cli/fetch): fix relative redirect (#6715)
Diffstat (limited to 'cli/js')
-rw-r--r--cli/js/web/fetch.ts6
1 files changed, 1 insertions, 5 deletions
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;