Skip to content

Commit

Permalink
fix: correctly filter out urls for tarballs in gitlab
Browse files Browse the repository at this point in the history
PR-URL: #69
Credit: @nlf
Close: #69
Reviewed-by: @isaacs
  • Loading branch information
nlf authored and isaacs committed Oct 15, 2020
1 parent d30f96e commit eb5bd5a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion git-host-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var gitHosts = module.exports = {
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
'httpstemplate': 'git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}',
'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}',
'pathmatch': /^[/]([^/]+)[/]((?!.*(\/-\/|\/repository\/archive\.tar\.gz\?=.*|\/repository\/[^/]+\/archive.tar.gz$)).*?)(?:[.]git|[/])?$/
'pathmatch': /^\/([^/]+)\/((?!.*(\/-\/|\/repository(\/[^/]+)?\/archive\.tar\.gz)).*?)(?:\.git|\/)?$/
},
gist: {
'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ],
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ module.exports = [
label: 'https.tar',
isUndefined: true
},
{
host: function (p) { return 'https://' + p.domain + '/' + p.owner + '/' + p.project + '/repository/archive.tar.gz?ref=' + p.branch },
label: 'https.tar',
isUndefined: true
},
{
host: function (p) { return 'https://' + p.domain + '/' + p.owner + '/' + p.project + '/repository/archive.tar.gz' },
label: 'https.tar',
isUndefined: true
},
{
host: function (p) { return 'git+https://' + p.domain + '/' + p.owner + '/' + p.project },
label: 'git+https'
Expand Down
2 changes: 1 addition & 1 deletion test/gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var testFixtures = function (t, params, fixtures) {
tt.is(hostinfo, undefined)
tt.end()
})
break
continue
}

t.test('hostinfo.https', function (tt) {
Expand Down

0 comments on commit eb5bd5a

Please # to comment.