Skip to content

Commit 1422f89

Browse files
fix: support dot in git@ URLS
1 parent 155b10a commit 1422f89

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import normalizeUrl from "normalize-url";
3737
const parseUrl = (url, normalize = false) => {
3838

3939
// Constants
40-
const GIT_RE = /((git@|http(s)?:\/\/)([\w\.@]+)(\/|:))(([\~,\w,\-,\_,\/]+)(.git){0,1}((\/){0,1}))/
40+
const GIT_RE = /((git@|http(s)?:\/\/)([\w\.@]+)(\/|:))(([\~,\.\w,\-,\_,\/]+)(.git){0,1}((\/){0,1}))/
4141

4242
if (typeof url !== "string" || !url.trim()) {
4343
const err = new Error("Invalid url.")

test/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,20 @@ const INPUTS = [
8888
, query: {}
8989
}
9090
]
91+
, [
92+
["[email protected]:halup/Cloud.API.Gateway.git", true]
93+
, {
94+
protocols: [ "ssh" ]
95+
, protocol: "ssh"
96+
, port: ""
97+
, resource: "halup"
98+
, user: ""
99+
, pathname: "/halup/Cloud.API.Gateway.git"
100+
, hash: ""
101+
, search: ""
102+
, query: {}
103+
}
104+
]
91105
];
92106

93107
tester.describe("check urls", test => {

0 commit comments

Comments
 (0)