diff --git a/CHANGES/pulp_file/5686.txt b/CHANGES/pulp_file/5686.txt new file mode 100644 index 00000000000..9b3605eb582 --- /dev/null +++ b/CHANGES/pulp_file/5686.txt @@ -0,0 +1 @@ +During sync, quote the URL path for file downloads using HTTP. diff --git a/pulp_file/app/tasks/synchronizing.py b/pulp_file/app/tasks/synchronizing.py index e7eaca0a235..dca6b76a807 100644 --- a/pulp_file/app/tasks/synchronizing.py +++ b/pulp_file/app/tasks/synchronizing.py @@ -2,7 +2,7 @@ import os from gettext import gettext as _ -from urllib.parse import urlparse, urlunparse +from urllib.parse import quote, urlparse, urlunparse from django.core.files import File @@ -114,6 +114,9 @@ async def run(self): for entry in entries: path = os.path.join(root_dir, entry.relative_path) + if not parsed_url.scheme == "file": + path = quote(path, safe=":/") + url = urlunparse(parsed_url._replace(path=path)) file = FileContent(relative_path=entry.relative_path, digest=entry.digest) artifact = Artifact(size=entry.size, sha256=entry.digest)