Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not parse tarball urls for gitlab #83

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion git-host-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 4 additions & 1 deletion test/gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down