Skip to content

Commit

Permalink
Fix the URL constructor calls in resolve_wasm_src(), `should_proxy_…
Browse files Browse the repository at this point in the history
…wasm_src()`, and `<DownloadLink />` to handle relative URLs
  • Loading branch information
whitphx committed Feb 20, 2024
1 parent c775c0c commit 1220e3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/wasm/svelte/DownloadLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
throw new Error("Wasm worker proxy is not available.");
}
const url = new URL(href);
const url = new URL(href, window.location.href);
const path = url.pathname;
is_downloading = true;
Expand Down
4 changes: 2 additions & 2 deletions js/wasm/svelte/file-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function should_proxy_wasm_src(src: MediaSrc): boolean {
return false;
}

const url = new URL(src);
const url = new URL(src, window.location.href);
if (!is_self_host(url)) {
// `src` is not accessing a local server resource, so we don't need to proxy this request to the Wasm worker.
return false;
Expand All @@ -33,7 +33,7 @@ export async function resolve_wasm_src(src: MediaSrc): Promise<MediaSrc> {
return src;
}

const url = new URL(src);
const url = new URL(src, window.location.href);
const path = url.pathname;
return maybeWorkerProxy
.httpRequest({
Expand Down

0 comments on commit 1220e3a

Please sign in to comment.