Repository navigation
sdk-python: URL-encode the remote path in download_file - #517
CapThunder19 wants to merge 1 commit into
Conversation
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>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What type of PR is this?
/kind bug
What this PR does / why we need it
download_fileput the remote path into the URL without encoding it. A#or?in a file name cut the path short, and a%XXsequence got decoded by PicoD. So the SDK could silently download a different file (e.g.data#v2.csvreturned the contents ofdata,%41.txtreturnedA.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_filenow URL-encodes the remote path, so files with#,?or%in their names download correctly.