Skip to content

Commit

Permalink
Replace custom URL parsing with url_to_path()
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Sep 1, 2020
1 parent 0b18e21 commit b097953
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/pip/_internal/req/req_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from pip._internal.network.utils import raise_for_status
from pip._internal.utils.encoding import auto_decode
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.utils.urls import get_url_scheme
from pip._internal.utils.urls import get_url_scheme, url_to_path

if MYPY_CHECK_RUNNING:
from optparse import Values
Expand Down Expand Up @@ -572,16 +572,7 @@ def get_file_content(url, session, comes_from=None):
'Requirements file {} references URL {}, '
'which is local'.format(comes_from, url)
)

path = url.split(':', 1)[1]
path = path.replace('\\', '/')
match = _url_slash_drive_re.match(path)
if match:
path = match.group(1) + ':' + path.split('|', 1)[1]
path = urllib_parse.unquote(path)
if path.startswith('/'):
path = '/' + path.lstrip('/')
url = path
url = url_to_path(url)

try:
with open(url, 'rb') as f:
Expand Down

0 comments on commit b097953

Please sign in to comment.