diff --git a/lib/index.js b/lib/index.js index 988665c..d3a55bc 100644 --- a/lib/index.js +++ b/lib/index.js @@ -37,7 +37,7 @@ import normalizeUrl from "normalize-url"; const parseUrl = (url, normalize = false) => { // Constants - const GIT_RE = /((git@|http(s)?:\/\/)([\w\.@]+)(\/|:))(([\~,\w,\-,\_,\/]+)(.git){0,1}((\/){0,1}))/ + const GIT_RE = /((git@|http(s)?:\/\/)([\w\.\-@]+)(\/|:))(([\~,\w,\-,\_,\/]+)(.git){0,1}((\/){0,1}))/ if (typeof url !== "string" || !url.trim()) { const err = new Error("Invalid url.") diff --git a/test/index.js b/test/index.js index 98b0a38..43d66a5 100644 --- a/test/index.js +++ b/test/index.js @@ -88,6 +88,21 @@ const INPUTS = [ , query: {} } ] + , [ + ["git@github.my-enterprise.com:my-org/my-repo.git", false], + { + protocols: [ 'ssh' ] + , protocol: 'ssh' + , port: '' + , resource: 'github.my-enterprise.com' + , user: 'git' + , password: '' + , pathname: '/my-org/my-repo.git' + , hash: '' + , search: '' + , query: {} + } + ] ]; tester.describe("check urls", test => {