Skip to content

Commit

Permalink
[Fix] properly parse a repo whose name starts with a dot
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo authored and ljharb committed Jan 31, 2023
1 parent eb7f2be commit abcd683
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function trimSlash(path) {
}

function name(str) {
return str ? str.replace(/^\W+|\.git$/g, '') : null;
return str ? str.replace(/\.git$/, '') : null;
}

function owner(str) {
Expand Down
1 change: 1 addition & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ describe('parse-github-url', function() {
assert.equal(gh('https://github.com/repos/assemble/dot.repo/tarball').name, 'dot.repo');
assert.equal(gh('https://github.com/repos/assemble/verb/zipball').name, 'verb');
assert.equal(gh('https://github.com/repos/assemble/dot.repo/zipball').name, 'dot.repo');
assert.equal(gh('SocialGouv/.kontinuous').name, '.kontinuous');
});

it('should get the host:', function() {
Expand Down

0 comments on commit abcd683

Please sign in to comment.