pacote@21.5.0.patch 896 B

123456789101112131415161718
  1. diff --git a/lib/git.js b/lib/git.js
  2. index 000ee9fc..a2a6cbb7 100644
  3. --- a/lib/git.js
  4. +++ b/lib/git.js
  5. @@ -254,8 +254,11 @@ class GitFetcher extends Fetcher {
  6. resolved: this.resolved,
  7. integrity: null, // it'll always be different, if we have one
  8. }).extract(tmp).then(() => handler(`${tmp}${this.spec.gitSubdir || ''}`), er => {
  9. - // fall back to ssh download if tarball fails
  10. - if (er.constructor.name.match(/^Http/)) {
  11. + // fall back to clone if the tarball download fails due to an
  12. + // HTTP error or if the response is not a valid tarball (e.g.
  13. + // a hosted provider returning an HTML sign-in page with 200)
  14. + if ((typeof er.statusCode === 'number' && er.statusCode >= 400) ||
  15. + /^TAR_/.test(er.code)) {
  16. return this.#clone(handler, false)
  17. } else {
  18. throw er