Skip to content

sdk-python: URL-encode the remote path in download_file - #517

Open
CapThunder19 wants to merge 1 commit into
volcano-sh:mainfrom
CapThunder19:fix/sdk-download-path-encoding
Open

CapThunder19 wants to merge 1 commit into
volcano-sh:mainfrom
CapThunder19:fix/sdk-download-path-encoding

Conversation

@CapThunder19

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it

download_file put the remote path into the URL without encoding it. A # or ? in a file name cut the path short, and a %XX sequence got decoded by PicoD. So the SDK could silently download a different file (e.g. data#v2.csv returned the contents of data, %41.txt returned A.txt) or get a 404 for a file that exists.

This encodes the path with urllib.parse.quote(..., safe="/") so folder separators still work, and adds a test covering #, ?, %, spaces and leading slashes.

Which issue(s) this PR fixes

Fixes #514

Special notes for your reviewer

Checked end to end through a real Router + PicoD: all the cases above now return the right file. The new test fails without the fix. The async client in #242 uses the same unencoded pattern, so it'll need the same one-line change.

Does this PR introduce a user-facing change?

Python SDK: download_file now URL-encodes the remote path, so files with #, ? or % in their names download correctly.

download_file put the remote path into the URL without encoding it. A '#' or '?' in a file name truncated the path, and a '%XX' sequence was decoded by PicoD, so the SDK could silently download a different file or get a 404.

Signed-off-by: Anirudh <anirudhpatwal19@gmail.com>
@volcano-sh-bot volcano-sh-bot added the kind/bug Something isn't working label Nov 16, 2026
@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign acsoto for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.76%. Comparing base (f521ae9) to head (b9df4fd).
⚠️ Report is 33 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #517      +/-   ##
==========================================
+ Coverage   60.45%   63.76%   +3.31%     
==========================================
  Files          35       35              
  Lines        3616     3657      +41     
==========================================
+ Hits         2186     2332     +146     
+ Misses       1211     1092     -119     
- Partials      219      233      +14     
Flag Coverage Δ
unittests 63.76% <ø> (+3.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sdk-python: download_file doesn't URL-encode the path, so some filenames download the wrong file

3 participants