Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Commit 918f7e7

Browse files
committed
fix repo-name regex
1 parent 5bbade4 commit 918f7e7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

lib/bam-cmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ bamCmd.getFullGitUrl = function (url) {
327327
*/
328328
bamCmd.getRepositoryName = function(url) {
329329

330-
var urlRegexp = /(([a-z\-\.]+)\.git)|([a-z\-\.]+(?!\.git))\/?$/i;
330+
var urlRegexp = /(([0-9a-z\-\.]+)\.git)|([0-9a-z\-\.]+(?!\.git))\/?$/i;
331331
var matches = urlRegexp.exec(url);
332332

333333
if (!matches) {

test/bam-cmd.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('bam-cmd main module', function() {
4141

4242
it('should throw Error on invalid name', function() {
4343
var fn = function() {
44-
bamCmd.getRepositoryName('01123');
44+
bamCmd.getRepositoryName(')');
4545
};
4646

4747
expect(fn).to.throw(Error);

test/fixtures/repositories.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,9 @@ module.exports = [
4444
repoFullName: '[email protected]:orga/repoWithMaj.git',
4545
repoName: 'repoWithMaj',
4646
},
47+
{
48+
givenParam: '[email protected]:foobar/v2.git',
49+
repoFullName: '[email protected]:foobar/v2.git',
50+
repoName: 'v2'
51+
},
4752
];

0 commit comments

Comments
 (0)