Skip to content

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

Closed
j1mb0-1 wants to merge 1 commit into
npm:mainfrom
j1mb0-1:fix-constructor-name-check
Closed

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

Conversation

@j1mb0-1

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

Copy link
Copy Markdown

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.

@owlstronaut

Copy link
Copy Markdown

Thank you for your contribution! THis touched the same line as another pr, so I combined them here: #481

@owlstronaut owlstronaut closed this May 1, 2026
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