Skip to content

Commit 1692435

Browse files
committed
fix: use gist tarball url that works for anonymous gists
Also, this saves an extra 302 redirect on every gist tarball request.
1 parent 8973221 commit 1692435

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

git-host-info.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var gitHosts = module.exports = {
4242
'httpstemplate': 'git+https://{domain}/{project}.git{#committish}',
4343
'shortcuttemplate': '{type}:{project}{#committish}',
4444
'pathtemplate': '{project}{#committish}',
45-
'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz',
45+
'tarballtemplate': 'https://codeload.github.com/gist/{project}/tar.gz/{committish}',
4646
'hashformat': function (fragment) {
4747
return 'file-' + formatHashFragment(fragment)
4848
}

test/gist.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test('fromUrl(gist url)', function (t) {
2525
t.is(hostinfo.file(''), 'https://gist.githubusercontent.com/111/' + proj + '/raw/' + (branch ? branch + '/' : ''), label + ' -> file')
2626
t.is(hostinfo.file('C'), 'https://gist.githubusercontent.com/111/' + proj + '/raw/' + (branch ? branch + '/' : '') + 'C', label + ' -> file')
2727
t.is(hostinfo.file('C/D'), 'https://gist.githubusercontent.com/111/' + proj + '/raw/' + (branch ? branch + '/' : '') + 'C/D', label + ' -> file')
28-
t.is(hostinfo.tarball(), 'https://gist.github.com/111/' + proj + '/archive/' + (branch || 'master') + '.tar.gz', label + ' -> tarball')
28+
t.is(hostinfo.tarball(), 'https://codeload.github.com/gist/' + proj + '/tar.gz/' + (branch || 'master'), label + ' -> tarball')
2929
}
3030
}
3131

0 commit comments

Comments
 (0)