Skip to content

Commit 3756d2f

Browse files
committed
fix: do not parse tarball urls for gitlab
PR-URL: #83 Credit: @nlf Close: #83 Reviewed-by: @wraithgar
1 parent 974bbca commit 3756d2f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

git-host-info.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ gitHosts.gitlab = Object.assign({}, defaults, {
7979
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish) || 'master'}`,
8080
extract: (url) => {
8181
const path = url.pathname.slice(1)
82-
if (path.includes('/-/')) {
82+
if (path.includes('/-/') || path.includes('/archive.tar.gz')) {
8383
return
8484
}
8585

test/gitlab.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ const invalid = [
66
// gitlab urls can contain a /-/ segment, make sure we ignore those
77
'https://gitlab.com/foo/-/something',
88
// missing project
9-
'https://gitlab.com/foo'
9+
'https://gitlab.com/foo',
10+
// tarball, this should not parse so that it can be used for pacote's remote fetcher
11+
'https://gitlab.com/foo/bar/repository/archive.tar.gz',
12+
'https://gitlab.com/foo/bar/repository/archive.tar.gz?ref=49b393e2ded775f2df36ef2ffcb61b0359c194c9'
1013
]
1114

1215
// assigning the constructor here is hacky, but the only way to make assertions that compare

0 commit comments

Comments
 (0)