From 9d37935f159fd9ce78046e8cdb9efc74e83869f2 Mon Sep 17 00:00:00 2001 From: lipinghai Date: Wed, 10 Oct 2018 18:54:53 +0800 Subject: [PATCH] fix: add support for url with port --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 63cf83d..6ec5434 100644 --- a/index.js +++ b/index.js @@ -7,9 +7,11 @@ module.exports = function (string) { string = string.replace('//www.', '//') // normalize git@ and https:git@ urls - string = string.replace(/^git@/, 'https://') - string = string.replace(/^https:git@/, 'https://') - string = string.replace('.com:', '.com/') + if (~string.indexOf('git@') || ~string.indexOf('https:git@')) { + string = string.replace(/^git@/, 'https://') + string = string.replace(/^https:git@/, 'https://') + string = string.replace('.com:', '.com/') + } if (!~string.indexOf('://')) { return false