fix: decode URL-encoded characters in asset filenames #569
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.
Fix URL-encoded characters in asset filenames
Problem
Closes #281
Chart packages with SemVer build metadata (e.g.,
cloudbees-core-3.11627+2e5eff15bf01.tgz) cause chart-releaser to crash.Root cause: GitHub encodes special characters in asset URLs (
+→%2B). When chart-releaser processes these URLs, it tries to access files using the encoded name (file%2Bversion.tgz) instead of the actual filename on disk (file+version.tgz), resulting in "file not found" errors.Solution
This PR adds URL decoding at two critical points in the release processing pipeline:
UpdateIndexFile()- Decodes the filename when extracting it from the asset URLaddToIndexFile()- Decodes the filename when constructing the local file pathThis ensures consistency between:
Changes
Core Implementation
url.PathUnescape()to decode filenames inUpdateIndexFile()(releaser.go:167-170)url.PathUnescape()to decode filenames inaddToIndexFile()(releaser.go:263-269)Test Coverage
index-file-with-url-encoded-plus-signtest-chart-0.1.0+build.1.tgzTesting
All existing tests pass, plus new test coverage for URL encoding:
$ go test ./pkg/releaser ok github.com/helm/chart-releaser/pkg/releaser 0.016s