Skip to content

Commit eb5bd5a

Browse files
nlfisaacs
authored andcommittedOct 15, 2020
fix: correctly filter out urls for tarballs in gitlab
PR-URL: #69 Credit: @nlf Close: #69 Reviewed-by: @isaacs
1 parent d30f96e commit eb5bd5a

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed
 

‎git-host-info.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var gitHosts = module.exports = {
2525
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
2626
'httpstemplate': 'git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}',
2727
'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}',
28-
'pathmatch': /^[/]([^/]+)[/]((?!.*(\/-\/|\/repository\/archive\.tar\.gz\?=.*|\/repository\/[^/]+\/archive.tar.gz$)).*?)(?:[.]git|[/])?$/
28+
'pathmatch': /^\/([^/]+)\/((?!.*(\/-\/|\/repository(\/[^/]+)?\/archive\.tar\.gz)).*?)(?:\.git|\/)?$/
2929
},
3030
gist: {
3131
'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ],

‎test/fixtures/gitlab.js

+10
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ module.exports = [
2424
label: 'https.tar',
2525
isUndefined: true
2626
},
27+
{
28+
host: function (p) { return 'https://' + p.domain + '/' + p.owner + '/' + p.project + '/repository/archive.tar.gz?ref=' + p.branch },
29+
label: 'https.tar',
30+
isUndefined: true
31+
},
32+
{
33+
host: function (p) { return 'https://' + p.domain + '/' + p.owner + '/' + p.project + '/repository/archive.tar.gz' },
34+
label: 'https.tar',
35+
isUndefined: true
36+
},
2737
{
2838
host: function (p) { return 'git+https://' + p.domain + '/' + p.owner + '/' + p.project },
2939
label: 'git+https'

‎test/gitlab.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var testFixtures = function (t, params, fixtures) {
1717
tt.is(hostinfo, undefined)
1818
tt.end()
1919
})
20-
break
20+
continue
2121
}
2222

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

0 commit comments

Comments
 (0)
Please sign in to comment.