diff --git a/news/6441.bugfix b/news/6441.bugfix new file mode 100644 index 00000000000..78da98ec3ec --- /dev/null +++ b/news/6441.bugfix @@ -0,0 +1 @@ +Unquote VCS path before testing for '@' diff --git a/src/pip/_internal/vcs/__init__.py b/src/pip/_internal/vcs/__init__.py index 6fca0793008..45160ab65b6 100644 --- a/src/pip/_internal/vcs/__init__.py +++ b/src/pip/_internal/vcs/__init__.py @@ -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, '')) diff --git a/tests/unit/test_vcs.py b/tests/unit/test_vcs.py index d720e406380..4053379397c 100644 --- a/tests/unit/test_vcs.py +++ b/tests/unit/test_vcs.py @@ -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): """