Skip to content

Commit

Permalink
Merge branch 'allow-hyphens-in-git-urls' of github.com:crenshaw-dev/p…
Browse files Browse the repository at this point in the history
…arse-url into new-version
  • Loading branch information
IonicaBizau committed Aug 3, 2022
2 parents 0790043 + 7e6b549 commit d98fd46
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -36,7 +36,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
16 changes: 16 additions & 0 deletions test/index.js
Expand Up @@ -109,6 +109,22 @@ const INPUTS = [
, query: {}
}
]
, [
["git@github.my-enterprise.com:my-org/my-repo.git", false],
{
protocols: [ 'ssh' ]
, protocol: 'ssh'
, port: ''
, resource: 'github.my-enterprise.com'
, host: 'github.my-enterprise.com'
, user: 'git'
, password: ''
, pathname: '/my-org/my-repo.git'
, hash: ''
, search: ''
, query: {}
}
]
];

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

0 comments on commit d98fd46

Please sign in to comment.