Skip to content

Commit

Permalink
fix: support dot in git@ URLS
Browse files Browse the repository at this point in the history
  • Loading branch information
GalHalupSeaLights committed Jul 31, 2022
1 parent 155b10a commit bdd9745
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -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.")
Expand Down
14 changes: 14 additions & 0 deletions test/index.js
Expand Up @@ -88,6 +88,20 @@ const INPUTS = [
, query: {}
}
]
, [
["git@github.com:halup/Cloud.API.Gateway.git", false]
, {
protocols: [ "ssh" ]
, protocol: "ssh"
, port: ""
, resource: "github.com"
, user: "git"
, pathname: "/halup/Cloud.API.Gateway.git"
, hash: ""
, search: ""
, query: {}
}
]
];

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

0 comments on commit bdd9745

Please sign in to comment.