Skip to content

Commit beac194

Browse files
committed
Fix non-compliant Git URL matching
RFC 3986 § 2.3 permits more characters in a URL than were matched. This corrects that, though there may be other deficiencies. This was a regression from v1.0.2, where at least “.” was matched without error.
1 parent ed44342 commit beac194

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-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

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
"git+https://user@hostname:project/blah.git",
2525
GitUrl("https://user@hostname/project/blah.git", None),
2626
),
27+
(
28+
"git+https://user@hostname:project~_-.foo/blah~_-.bar.git",
29+
GitUrl("https://user@hostname/project~_-.foo/blah~_-.bar.git", None),
30+
),
2731
(
2832
"git+ssh://[email protected]:sdispater/poetry.git#v1.0.27",
2933
GitUrl("[email protected]:sdispater/poetry.git", "v1.0.27"),

0 commit comments

Comments
 (0)