Skip to content

Commit 7d5934e

Browse files
authored
Merge pull request #2018 from amarshall/fix-git-url-pattern
Fix non-compliant Git URL matching
2 parents ed44342 + 7348893 commit 7d5934e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

poetry/vcs/git.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"user": r"[a-zA-Z0-9_.-]+",
1313
"resource": r"[a-zA-Z0-9_.-]+",
1414
"port": r"\d+",
15-
"path": r"[\w\-/\\]+",
16-
"name": r"[\w\-]+",
15+
"path": r"[\w~.\-/\\]+",
16+
"name": r"[\w~.\-]+",
1717
"rev": r"[^@#]+",
1818
}
1919

tests/vcs/test_git.py

+16
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
"git+https://user@hostname/project/blah.git",
2121
GitUrl("https://user@hostname/project/blah.git", None),
2222
),
23+
(
24+
"git+https://user@hostname/project~_-.foo/blah~_-.bar.git",
25+
GitUrl("https://user@hostname/project~_-.foo/blah~_-.bar.git", None),
26+
),
2327
(
2428
"git+https://user@hostname:project/blah.git",
2529
GitUrl("https://user@hostname/project/blah.git", None),
@@ -98,6 +102,18 @@ def test_normalize_url(url, normalized):
98102
"https", "hostname", "/project/blah.git", "user", None, "blah", None
99103
),
100104
),
105+
(
106+
"git+https://user@hostname/project~_-.foo/blah~_-.bar.git",
107+
ParsedUrl(
108+
"https",
109+
"hostname",
110+
"/project~_-.foo/blah~_-.bar.git",
111+
"user",
112+
None,
113+
"blah~_-.bar",
114+
None,
115+
),
116+
),
101117
(
102118
"git+https://user@hostname:project/blah.git",
103119
ParsedUrl(

0 commit comments

Comments
 (0)