Skip to content

Commit

Permalink
Unquote path before testing for '@'
Browse files Browse the repository at this point in the history
The url can be quoted so the '@' will be %20 and it will not be split as
revision number.
  • Loading branch information
cedk committed Apr 24, 2019
1 parent 9816d17 commit d4377db
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/6441.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unquote VCS path before testing for '@'
1 change: 1 addition & 0 deletions src/pip/_internal/vcs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def get_url_rev_and_auth(cls, url):
scheme = scheme.split('+', 1)[1]
netloc, user_pass = cls.get_netloc_and_auth(netloc, scheme)
rev = None
path = urllib_parse.unquote(path)
if '@' in path:
path, rev = path.rsplit('@', 1)
url = urllib_parse.urlunsplit((scheme, netloc, path, query, ''))
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/test_vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ def test_git__get_url_rev__idempotent():
# Test a "+" in the path portion.
('svn+https://svn.example.com/My+Project',
('https://svn.example.com/My+Project', None, (None, None))),
('hg+https://hg.example.com/MyProject@default',
('https://hg.example.com/MyProject', 'default', (None, None))),
# Test with "@" quoted.
('hg+https://hg.example.com/MyProject%40default',
('https://hg.example.com/MyProject', 'default', (None, None))),
])
def test_version_control__get_url_rev_and_auth(url, expected):
"""
Expand Down

0 comments on commit d4377db

Please sign in to comment.