Skip to content

Commit

Permalink
Fix non-compliant Git URL matching
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
amarshall committed Feb 11, 2020
1 parent ed44342 commit beac194
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions poetry/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"user": r"[a-zA-Z0-9_.-]+",
"resource": r"[a-zA-Z0-9_.-]+",
"port": r"\d+",
"path": r"[\w\-/\\]+",
"name": r"[\w\-]+",
"path": r"[\w~.\-/\\]+",
"name": r"[\w~.\-]+",
"rev": r"[^@#]+",
}

Expand Down
4 changes: 4 additions & 0 deletions tests/vcs/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"git+https://user@hostname:project/blah.git",
GitUrl("https://user@hostname/project/blah.git", None),
),
(
"git+https://user@hostname:project~_-.foo/blah~_-.bar.git",
GitUrl("https://user@hostname/project~_-.foo/blah~_-.bar.git", None),
),
(
"git+ssh://git@github.com:sdispater/poetry.git#v1.0.27",
GitUrl("git@github.com:sdispater/poetry.git", "v1.0.27"),
Expand Down

0 comments on commit beac194

Please sign in to comment.