diff --git a/dist/index.js b/dist/index.js index c9f2c63..da59716 100755 --- a/dist/index.js +++ b/dist/index.js @@ -290,11 +290,11 @@ const parseUrl = (url, normalize = false) => { // Constants /** - * ([a-z_][a-z0-9_-]{0,31}) Try to match the user + * ([a-zA-Z_][a-zA-Z0-9_-]{0,31}) Try to match the user * ([\w\.\-@]+) Match the host/resource * (([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?) Match the path, allowing spaces/white */ - const GIT_RE = /^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/; + const GIT_RE = /^(?:([a-zA-Z_][a-zA-Z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/; const throwErr = msg => { const err = new Error(msg); diff --git a/dist/index.mjs b/dist/index.mjs index 1bdc216..907bc3a 100755 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -284,11 +284,11 @@ const parseUrl = (url, normalize = false) => { // Constants /** - * ([a-z_][a-z0-9_-]{0,31}) Try to match the user + * ([a-zA-Z_][a-zA-Z0-9_-]{0,31}) Try to match the user * ([\w\.\-@]+) Match the host/resource * (([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?) Match the path, allowing spaces/white */ - const GIT_RE = /^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/; + const GIT_RE = /^(?:([a-zA-Z_][a-zA-Z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/; const throwErr = msg => { const err = new Error(msg); diff --git a/package-lock.json b/package-lock.json index e4078b1..4090486 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "parse-url", - "version": "9.0.0", + "version": "9.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "parse-url", - "version": "9.0.0", + "version": "9.0.1", "license": "MIT", "dependencies": { "@types/parse-path": "^7.0.0", diff --git a/src/index.js b/src/index.js index 4ddbab0..ba64bad 100644 --- a/src/index.js +++ b/src/index.js @@ -38,11 +38,11 @@ const parseUrl = (url, normalize = false) => { // Constants /** - * ([a-z_][a-z0-9_-]{0,31}) Try to match the user + * ([a-zA-Z_][a-zA-Z0-9_-]{0,31}) Try to match the user * ([\w\.\-@]+) Match the host/resource * (([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?) Match the path, allowing spaces/white */ - const GIT_RE = /^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/; + const GIT_RE = /^(?:([a-zA-Z_][a-zA-Z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/; const throwErr = msg => { const err = new Error(msg) diff --git a/test/index.mjs b/test/index.mjs index ca99728..e110346 100644 --- a/test/index.mjs +++ b/test/index.mjs @@ -247,6 +247,26 @@ const INPUTS = [ parse_failed: false, }, ], + [ + [ + "ORG@vs-ssh.visualstudio.com:v3/ORG/My-Project/repo", + false, + ], + { + protocols: ["ssh"], + protocol: "ssh", + port: "", + resource: "vs-ssh.visualstudio.com", + host: "vs-ssh.visualstudio.com", + user: "ORG", + password: "", + pathname: "/v3/ORG/My-Project/repo", + hash: "", + search: "", + query: {}, + parse_failed: false, + }, + ], [ [ "https://ORG@dev.azure.com/ORG/My%20Project/_git/repo",