mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Replace %xx escapes in urls
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
This commit is contained in:
parent
cc8e2ced12
commit
ff120795fb
1 changed files with 6 additions and 4 deletions
|
|
@ -244,10 +244,12 @@ def _download_file(url, required_length, STRICT_REQUIRED_LENGTH=True):
|
|||
securesystemslib.formats.URL_SCHEMA.check_match(url)
|
||||
securesystemslib.formats.LENGTH_SCHEMA.check_match(required_length)
|
||||
|
||||
# 'url.replace()' is for compatibility with Windows-based systems because
|
||||
# they might put back-slashes in place of forward-slashes. This converts it
|
||||
# to the common format.
|
||||
url = url.replace('\\', '/')
|
||||
# 'url.replace('\\', '/')' is needed for compatibility with Windows-based
|
||||
# systems, because they might use back-slashes in place of forward-slashes.
|
||||
# This converts it to the common format. unquote() replaces %xx escapes in a
|
||||
# url with their single-character equivalent. A back-slash may be encoded as
|
||||
# %5c in the url, which should also be replaced with a forward slash.
|
||||
url = six.moves.urllib.parse.unquote(url).replace('\\', '/')
|
||||
logger.info('Downloading: ' + repr(url))
|
||||
|
||||
# This is the temporary file that we will return to contain the contents of
|
||||
|
|
|
|||
Loading…
Reference in a new issue