summaryrefslogtreecommitdiff
path: root/cli/js/web/fetch.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/web/fetch.ts')
-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;