Skip to content

fix: use statusCode instead of constructor name for tarball fallback#478

Open
j1mb0-1 wants to merge 1 commit intonpm:mainfrom
j1mb0-1:fix-constructor-name-check
Open

fix: use statusCode instead of constructor name for tarball fallback#478
j1mb0-1 wants to merge 1 commit intonpm:mainfrom
j1mb0-1:fix-constructor-name-check

Conversation

@j1mb0-1
Copy link
Copy Markdown

@j1mb0-1 j1mb0-1 commented Apr 24, 2026

The tarball-to-clone fallback in GitFetcher.#clone() uses er.constructor.name.match(/^Http/) to detect HTTP errors from npm-registry-fetch. This breaks when pacote is consumed by bundlers that minify identifiers (e.g. Bun's Bun.build() with minify: true, esbuild with minifyIdentifiers), because HttpErrorGeneral gets renamed to something like jB and the regex no longer matches.

When this happens, the fallback to SSH git clone never fires, and private hosted git repos (GitLab, GitHub) fail with a 403 or 404 from the tarball download with no recovery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants