Skip to content

Commit 177ca32

Browse files
committed
Fix title problem when repo url doesn't have .git suffix
1 parent 892ec04 commit 177ca32

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bin/utils.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,18 @@ function gitURL(path) {
3232
// Poorman's parsing
3333
// Parse a git URL to a github ID : username/reponame
3434
function githubID(_url) {
35+
// Remove .git if it's in _url
36+
var sliceEnd = _url.slice(-4) === '.git' ? -4 : _url.length;
37+
3538
// Detect HTTPS repos
3639
var parsed = url.parse(_url);
3740
if(parsed.protocol === 'https:' && parsed.host === 'github.com') {
38-
return parsed.path.slice(1, -4);
41+
return parsed.path.slice(1, sliceEnd);
3942
}
4043

4144
// Detect SSH repos
4245
if(_url.indexOf('git@') === 0) {
43-
return _url.split(':', 2)[1].slice(0, -4);
46+
return _url.split(':', 2)[1].slice(0, sliceEnd);
4447
}
4548

4649
// None found

0 commit comments

Comments
 (0)