Merge pull request #4514 from pypa/bugfix/4089

Bugfix: don't unquote file URL
This commit is contained in:
Frost Ming
2020-11-04 17:20:20 +08:00
committed by GitHub
4 changed files with 8 additions and 7 deletions
+1
View File
@@ -0,0 +1 @@
Fix a bug that percent encoded characters will be unquoted incorrectly in the file URL.
+4 -4
View File
@@ -1799,7 +1799,7 @@ class FileRequirement(object):
if link_info:
link = link_info.link
if link.url_without_fragment:
uri = unquote(link.url_without_fragment)
uri = link.url_without_fragment
extras = () # type: Optional[Tuple[STRING_TYPE, ...]]
if "extras" in pipfile:
extras = tuple(pipfile["extras"]) # type: ignore
@@ -1821,10 +1821,10 @@ class FileRequirement(object):
else:
if name:
line_name = "{0}{1}".format(name, extras_string)
line = "{0}#egg={1}".format(unquote(link.url_without_fragment), line_name)
line = "{0}#egg={1}".format(link.url_without_fragment, line_name)
else:
if link:
line = unquote(link.url)
line = link.url
elif uri and isinstance(uri, six.string_types):
line = uri
else:
@@ -1847,7 +1847,7 @@ class FileRequirement(object):
link_url = None # type: Optional[STRING_TYPE]
seed = None # type: Optional[STRING_TYPE]
if self.link is not None:
link_url = unquote(self.link.url_without_fragment)
link_url = self.link.url_without_fragment
is_vcs = getattr(self.link, "is_vcs", not self.link.is_artifact)
if self._uri_scheme and self._uri_scheme == "path":
# We may need any one of these for passing to pip
+2 -2
View File
@@ -25,7 +25,7 @@ from distlib.wheel import Wheel
from packaging.markers import Marker
from pip_shims.utils import call_function_with_correct_args
from six.moves import configparser
from six.moves.urllib.parse import unquote, urlparse, urlunparse
from six.moves.urllib.parse import urlparse, urlunparse
from vistir.compat import FileNotFoundError, Iterable, Mapping, Path, finalize, lru_cache
from vistir.contextmanagers import cd, temp_path
from vistir.misc import run
@@ -1893,7 +1893,7 @@ build-backend = "{1}"
session = cmd._build_session(options)
finder = cmd._build_package_finder(options, session)
tempdir_manager = stack.enter_context(pip_shims.shims.global_tempdir_manager())
vcs, uri = split_vcs_method_from_uri(unquote(ireq.link.url_without_fragment))
vcs, uri = split_vcs_method_from_uri(ireq.link.url_without_fragment)
parsed = urlparse(uri)
if "file" in parsed.scheme:
url_path = parsed.path
+1 -1
View File
@@ -26,7 +26,7 @@ requests==2.23.0
idna==2.9
urllib3==1.25.9
certifi==2020.4.5.1
requirementslib==1.5.14
requirementslib==1.5.15
attrs==19.3.0
distlib==0.3.0
packaging==20.3