Skip to content

Commit 96ea106

Browse files
committed
Merge branch 'ado-git-ssh-fix' of github.com:Srokap/parse-url into new-version
2 parents 38f7f5d + f11a5bb commit 96ea106

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

dist/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,11 @@ const parseUrl = (url, normalize = false) => {
290290

291291
// Constants
292292
/**
293-
* ([a-z_][a-z0-9_-]{0,31}) Try to match the user
293+
* ([a-zA-Z_][a-zA-Z0-9_-]{0,31}) Try to match the user
294294
* ([\w\.\-@]+) Match the host/resource
295295
* (([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?) Match the path, allowing spaces/white
296296
*/
297-
const GIT_RE = /^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/;
297+
const GIT_RE = /^(?:([a-zA-Z_][a-zA-Z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/;
298298

299299
const throwErr = msg => {
300300
const err = new Error(msg);

dist/index.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,11 @@ const parseUrl = (url, normalize = false) => {
284284

285285
// Constants
286286
/**
287-
* ([a-z_][a-z0-9_-]{0,31}) Try to match the user
287+
* ([a-zA-Z_][a-zA-Z0-9_-]{0,31}) Try to match the user
288288
* ([\w\.\-@]+) Match the host/resource
289289
* (([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?) Match the path, allowing spaces/white
290290
*/
291-
const GIT_RE = /^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/;
291+
const GIT_RE = /^(?:([a-zA-Z_][a-zA-Z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/;
292292

293293
const throwErr = msg => {
294294
const err = new Error(msg);

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ const parseUrl = (url, normalize = false) => {
3838

3939
// Constants
4040
/**
41-
* ([a-z_][a-z0-9_-]{0,31}) Try to match the user
41+
* ([a-zA-Z_][a-zA-Z0-9_-]{0,31}) Try to match the user
4242
* ([\w\.\-@]+) Match the host/resource
4343
* (([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?) Match the path, allowing spaces/white
4444
*/
45-
const GIT_RE = /^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/;
45+
const GIT_RE = /^(?:([a-zA-Z_][a-zA-Z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/;
4646

4747
const throwErr = msg => {
4848
const err = new Error(msg)

test/index.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,26 @@ const INPUTS = [
247247
parse_failed: false,
248248
},
249249
],
250+
[
251+
[
252+
"ORG@vs-ssh.visualstudio.com:v3/ORG/My-Project/repo",
253+
false,
254+
],
255+
{
256+
protocols: ["ssh"],
257+
protocol: "ssh",
258+
port: "",
259+
resource: "vs-ssh.visualstudio.com",
260+
host: "vs-ssh.visualstudio.com",
261+
user: "ORG",
262+
password: "",
263+
pathname: "/v3/ORG/My-Project/repo",
264+
hash: "",
265+
search: "",
266+
query: {},
267+
parse_failed: false,
268+
},
269+
],
250270
[
251271
[
252272
"https://ORG@dev.azure.com/ORG/My%20Project/_git/repo",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy