fix(pkgfetcher): encode + as %2B in download URLs#477
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes package download failures from S3/CloudFront-backed repositories by ensuring + characters in package filenames are encoded as %2B in HTTP request URLs, avoiding 403s caused by + being interpreted as a space.
Changes:
- Add
stringsdependency to support URL rewriting. - Rewrite the request URL in
downloadWithRetry()to replace+with%2Bbefore callingclient.Get().
You can also share your feedback on Copilot code review. Take the survey.
samueltaripin
approved these changes
Mar 11, 2026
srmungar
reviewed
Mar 11, 2026
c17074c to
16b0cd6
Compare
srmungar
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge Checklist
All boxes should be checked before merging the PR
Description
Problem: When downloading
.debpackages from S3/CloudFront-backed repositories (e.g. ECI, AMR), packages with+in their filenames fail with HTTP 403 Forbidden. JIRA#ITEP-88403Examples of affected packages:
systemd-boot_255.4-1ubuntu8.12-ecir8+etf+taprio+mqprio+fpe+ffw_amd64.debsystemd-resolved_255.4-1ubuntu8.12-ecir8+etf+taprio+mqprio+fpe+ffw_amd64.debsystemd-timesyncd_255.4-1ubuntu8.12-ecir8+etf+taprio+mqprio+fpe+ffw_amd64.debRoot cause: S3/CloudFront interprets a literal
+in the URL path as a space character (per RFC 1630 query-string encoding). The server cannot find the object and returns 403 (not 404) because the S3 bucket is configured to hide missing objects.Fix: In
downloadWithRetry(), encode+as%2Bin the HTTP request URL only. The local filename retains the original+. Single-line change:Any Newly Introduced Dependencies
None.
How Has This Been Tested?
os-image-composerwith the fix appliedubuntu24-x86_64-robotics-jazzy-raw.ymltemplate which uses ECI and AMR repos containing packages with+in filenames+etf+taprio+mqprio+fpe+ffwin their names all failed with 403.debfiles retain the original+in their local filenames (needed by dpkg-scanpackages)