Skip to content

Commit

Permalink
Merge branch 'ado-git-ssh-fix' of github.com:Srokap/parse-url into ne…
Browse files Browse the repository at this point in the history
…w-version
  • Loading branch information
IonicaBizau committed Apr 3, 2024
2 parents 38f7f5d + f11a5bb commit 96ea106
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dist/index.js
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions dist/index.mjs
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Expand Up @@ -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)
Expand Down
20 changes: 20 additions & 0 deletions test/index.mjs
Expand Up @@ -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",
Expand Down

0 comments on commit 96ea106

Please sign in to comment.