Skip to content

Commit 7f12592

Browse files
authored
Use origin instead of hostname to compare host change (#1438)
Eg if hub is on localhost:3000 and S3 on localhost:9000 the authorization header would be forwarded to the S3 causing errors. (change could alternatively be made in `downloadFile`)
1 parent 9edd34d commit 7f12592

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/hub/src/lib/file-download-info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export async function fileDownloadInfo(
144144
// Cannot use resp.url in case it's a S3 url and the user adds an Authorization header to it.
145145
url:
146146
resp.url &&
147-
(new URL(resp.url).hostname === new URL(hubUrl).hostname || resp.headers.get("X-Cache")?.endsWith(" cloudfront"))
147+
(new URL(resp.url).origin === new URL(hubUrl).origin || resp.headers.get("X-Cache")?.endsWith(" cloudfront"))
148148
? resp.url
149149
: url,
150150
};

0 commit comments

Comments
 (0)