Skip to content

Commit

Permalink
Fix URL encoding issue in pulp_file
Browse files Browse the repository at this point in the history
closes #5686
  • Loading branch information
sbernhard authored and m-bucher committed Sep 26, 2024
1 parent 79b87ef commit b9bff9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/pulp_file/5686.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
During sync, quote the URL path for file downloads using HTTP.
5 changes: 4 additions & 1 deletion pulp_file/app/tasks/synchronizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b9bff9f

Please sign in to comment.