Skip to content

Commit aa59192

Browse files
author
Ivana Atanasova
committed
Remove URL normalisation
As a target path is a URL path it's not correct to consider it as interchangeable with a filepath within every operation system. The unquote is also removed as the ngclient cannot assume correctly which encoding is intended and which not Fixes theupdateframework#1483 Signed-off-by: Ivana Atanasova <iyovcheva@iyovcheva-a02.vmware.com>
1 parent 600eb86 commit aa59192

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

tests/test_updater_ng.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def setUp(self) -> None:
112112
+ utils.TEST_HOST_ADDRESS
113113
+ ":"
114114
+ str(self.server_process_handler.port)
115-
+ repository_basepath
115+
+ repository_basepath.replace("\\","/")
116116
)
117117

118118
self.metadata_url = f"{url_prefix}/metadata/"

tuf/ngclient/fetcher.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import tempfile
1111
from contextlib import contextmanager
1212
from typing import IO, Iterator
13-
from urllib import parse
1413

1514
from tuf import exceptions
1615

@@ -61,13 +60,6 @@ def download_file(self, url: str, max_length: int) -> Iterator[IO]:
6160
Yields:
6261
A TemporaryFile object that points to the contents of 'url'.
6362
"""
64-
# 'url.replace('\\', '/')' is needed for compatibility with
65-
# Windows-based systems, because they might use back-slashes in place
66-
# of forward-slashes. This converts it to the common format.
67-
# unquote() replaces %xx escapes in a url with their single-character
68-
# equivalent. A back-slash may beencoded as %5c in the url, which
69-
# should also be replaced with a forward slash.
70-
url = parse.unquote(url).replace("\\", "/")
7163
logger.debug("Downloading: %s", url)
7264

7365
number_of_bytes_received = 0

0 commit comments

Comments
 (0)