Skip to content

Commit

Permalink
fix: use gist tarball url that works for anonymous gists
Browse files Browse the repository at this point in the history
Also, this saves an extra 302 redirect on every gist tarball request.
  • Loading branch information
isaacs committed Aug 5, 2019
1 parent 8973221 commit 1692435
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion git-host-info.js
Expand Up @@ -42,7 +42,7 @@ var gitHosts = module.exports = {
'httpstemplate': 'git+https://{domain}/{project}.git{#committish}',
'shortcuttemplate': '{type}:{project}{#committish}',
'pathtemplate': '{project}{#committish}',
'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz',
'tarballtemplate': 'https://codeload.github.com/gist/{project}/tar.gz/{committish}',
'hashformat': function (fragment) {
return 'file-' + formatHashFragment(fragment)
}
Expand Down
2 changes: 1 addition & 1 deletion test/gist.js
Expand Up @@ -25,7 +25,7 @@ test('fromUrl(gist url)', function (t) {
t.is(hostinfo.file(''), 'https://gist.githubusercontent.com/111/' + proj + '/raw/' + (branch ? branch + '/' : ''), label + ' -> file')
t.is(hostinfo.file('C'), 'https://gist.githubusercontent.com/111/' + proj + '/raw/' + (branch ? branch + '/' : '') + 'C', label + ' -> file')
t.is(hostinfo.file('C/D'), 'https://gist.githubusercontent.com/111/' + proj + '/raw/' + (branch ? branch + '/' : '') + 'C/D', label + ' -> file')
t.is(hostinfo.tarball(), 'https://gist.github.com/111/' + proj + '/archive/' + (branch || 'master') + '.tar.gz', label + ' -> tarball')
t.is(hostinfo.tarball(), 'https://codeload.github.com/gist/' + proj + '/tar.gz/' + (branch || 'master'), label + ' -> tarball')
}
}

Expand Down

0 comments on commit 1692435

Please sign in to comment.