Skip to content

Commit 1c25b8e

Browse files
KernelArelekang
authored andcommitted
fix(parse_git_url): fix bad url with dash
1 parent 82bfcd3 commit 1c25b8e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

semantic_release/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def parse_git_url(url: str) -> ParsedGitUrl:
119119
(r"^git\+ssh://", "ssh://"),
120120
# normalize an scp like syntax to URL compatible syntax
121121
# excluding port definitions (:#####) & including numeric usernames
122-
(r"(ssh://(?:\w+@)?[\w.]+):(?!\d{1,5}/\w+/)(.*)$", r"\1/\2"),
122+
(r"(ssh://(?:\w+@)?[\w.-]+):(?!\d{1,5}/\w+/)(.*)$", r"\1/\2"),
123123
# normalize implicit file (windows || posix) urls to explicit file:// urls
124124
(r"^([C-Z]:/)|^/(\w)", r"file:///\1\2"),
125125
]

tests/unit/semantic_release/test_helpers.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"http://git.mycompany.com/username/myproject.git",
1111
ParsedGitUrl("http", "git.mycompany.com", "username", "myproject"),
1212
),
13+
(
14+
"http://subsubdomain.subdomain.company-net.com/username/myproject.git",
15+
ParsedGitUrl("http", "subsubdomain.subdomain.company-net.com", "username", "myproject"),
16+
),
1317
(
1418
"https://github.com/username/myproject.git",
1519
ParsedGitUrl("https", "github.com", "username", "myproject"),
@@ -22,6 +26,10 @@
2226
"https://git.mycompany.com:4443/username/myproject.git",
2327
ParsedGitUrl("https", "git.mycompany.com:4443", "username", "myproject"),
2428
),
29+
(
30+
"https://subsubdomain.subdomain.company-net.com/username/myproject.git",
31+
ParsedGitUrl("https", "subsubdomain.subdomain.company-net.com", "username", "myproject"),
32+
),
2533
(
2634
"git://host.xz/path/to/repo.git/",
2735
ParsedGitUrl("git", "host.xz", "path/to", "repo"),
@@ -34,6 +42,10 @@
3442
"[email protected]:username/myproject.git",
3543
ParsedGitUrl("ssh", "[email protected]", "username", "myproject"),
3644
),
45+
(
46+
"[email protected]:username/myproject.git",
47+
ParsedGitUrl("ssh", "[email protected]", "username", "myproject"),
48+
),
3749
(
3850
"ssh://[email protected]:3759/myproject.git",
3951
ParsedGitUrl("ssh", "[email protected]", "3759", "myproject"),
@@ -46,6 +58,10 @@
4658
"ssh://[email protected]:7999/username/myproject.git",
4759
ParsedGitUrl("ssh", "[email protected]:7999", "username", "myproject"),
4860
),
61+
(
62+
"ssh://[email protected]:username/myproject.git",
63+
ParsedGitUrl("ssh", "[email protected]", "username", "myproject"),
64+
),
4965
(
5066
"git+ssh://[email protected]:username/myproject.git",
5167
ParsedGitUrl("ssh", "[email protected]", "username", "myproject"),

0 commit comments

Comments
 (0)