From 169243550484e0ed22bb424cd45b237266af1003 Mon Sep 17 00:00:00 2001 From: isaacs Date: Sun, 4 Aug 2019 22:51:35 -0700 Subject: [PATCH] fix: use gist tarball url that works for anonymous gists Also, this saves an extra 302 redirect on every gist tarball request. --- git-host-info.js | 2 +- test/gist.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git-host-info.js b/git-host-info.js index 94cd176..d81be20 100644 --- a/git-host-info.js +++ b/git-host-info.js @@ -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) } diff --git a/test/gist.js b/test/gist.js index a40cf26..468483d 100644 --- a/test/gist.js +++ b/test/gist.js @@ -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') } }