diff --git a/git-host-info.js b/git-host-info.js index 360d7b0..d491934 100644 --- a/git-host-info.js +++ b/git-host-info.js @@ -79,7 +79,7 @@ gitHosts.gitlab = Object.assign({}, defaults, { tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish) || 'master'}`, extract: (url) => { const path = url.pathname.slice(1) - if (path.includes('/-/')) { + if (path.includes('/-/') || path.includes('/archive.tar.gz')) { return } diff --git a/test/gitlab.js b/test/gitlab.js index 205f94a..feb613f 100644 --- a/test/gitlab.js +++ b/test/gitlab.js @@ -6,7 +6,10 @@ const invalid = [ // gitlab urls can contain a /-/ segment, make sure we ignore those 'https://gitlab.com/foo/-/something', // missing project - 'https://gitlab.com/foo' + 'https://gitlab.com/foo', + // tarball, this should not parse so that it can be used for pacote's remote fetcher + 'https://gitlab.com/foo/bar/repository/archive.tar.gz', + 'https://gitlab.com/foo/bar/repository/archive.tar.gz?ref=49b393e2ded775f2df36ef2ffcb61b0359c194c9' ] // assigning the constructor here is hacky, but the only way to make assertions that compare