Skip to content

Commit cc840b2

Browse files
authored
fix: incorrect registry origin check (#743)
1 parent c9f3892 commit cc840b2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sources/httpUtils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ async function fetch(input: string | URL, init?: RequestInit) {
2929
input.username = input.password = ``;
3030
}
3131

32-
if (input.origin === (process.env.COREPACK_NPM_REGISTRY || DEFAULT_NPM_REGISTRY_URL) && process.env.COREPACK_NPM_TOKEN) {
32+
const registry = process.env.COREPACK_NPM_TOKEN && new URL(process.env.COREPACK_NPM_REGISTRY || DEFAULT_NPM_REGISTRY_URL);
33+
34+
if (registry && input.origin === registry.origin) {
3335
headers = {
3436
...headers,
3537
authorization: `Bearer ${process.env.COREPACK_NPM_TOKEN}`,

0 commit comments

Comments
 (0)