Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unquote path before testing for '@' #6441

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/6437.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unquote VCS path before testing for '@'
2 changes: 2 additions & 0 deletions src/pip/_internal/vcs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,10 @@ 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)
path = urllib_parse.quote(path)
url = urllib_parse.urlunsplit((scheme, netloc, path, query, ''))
return url, rev, user_pass

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