fix(s3): percent-encode object keys in download URLs#872
Merged
PaulHax merged 1 commit intoKitware:mainfrom May 8, 2026
Merged
fix(s3): percent-encode object keys in download URLs#872PaulHax merged 1 commit intoKitware:mainfrom
PaulHax merged 1 commit intoKitware:mainfrom
Conversation
`getObjectPublicUrl` interpolated S3 keys directly into the URL path. S3 keys may legally contain reserved URI delimiters (`?`, `#`), space, `+`, etc., per AWS object key naming guidelines, and `ListObjectsV2` returns them verbatim. Per RFC 3986, `?` starts a query string and `#` a fragment, so a key like `scan?1.dcm` was sent as `GET /scan?1.dcm` (object `scan` + query `1.dcm` => 404), and `seg#1.dcm` had its fragment stripped before the request even left the browser. Split keys on `/` and `encodeURIComponent` each segment to preserve the hierarchy while encoding everything else. Tests cover `?`, `#`, space, `+`, and a multi-segment key.
✅ Deploy Preview for volview-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
S3 keys may contain
?,#, space,+, etc. (per AWS object-key rules), andListObjectsV2returns them verbatim.getObjectPublicUrlinterpolated keys raw, so e.g.scan?1.dcmwas sent asGET /scan?1.dcm(404) andseg#1.dcmlost its#1.dcmto the fragment.Split on
/,encodeURIComponenteach segment. Tests cover?,#, space,+, and a multi-segment key.