fix: URL encoding of file location returned by createFile - #591
fix: URL encoding of file location returned by createFile#591AdrianCurtin wants to merge 2 commits into
Conversation
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code. |
|
Warning Review limit reached
Next review available in: 58 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Issue
Closes: #461
createFile()builds theLocationit returns by interpolatingparams.Keystraight into a URL. The key is raw, so a filename containing a space or other URL-sensitive character produces a technically malformed URL:https://bucket.s3.region.amazonaws.com/test/my file (1).txthttps://bucket.s3.region.amazonaws.com/test/my%20file%20(1).txtApproach
Encode each path segment of the key when building the URL, the same way
getFileLocation()already does, so separators stay separators:The key handed to S3 is untouched and stays raw, which is what the SDK expects. Only the returned URL changes.
Both return paths are covered.
createFileresolvesLocationin two places, the streamingUploadpath and the bufferPutObjectCommandpath, and both had the bug.Tests
spec/test.spec.jsgains a case per return path, usingmy file (1).txtfrom the issue. Both assert the encoded form is present, the raw form is absent, and that thebucketPrefixseparator is not encoded to%2F. Both fail against the previousLocationand pass here.Full suite passes.
Related pull requests
These all touch
createFileorgetFileLocationinindex.js. Merging them in this order leaves the fewest conflicts, verified by trial merges of all six together, which pass the suite once resolved:#336 → #594 → #597 → #591 → #593 → #242
generateKeyLocationurlLocationomitted the bucket for custom endpointscreateFilereporting the stored name and url#336 and #594 conflict with nothing. The rest collide on the
createFileprologue and on the same anchor inspec/test.spec.js, where the conflict truncates each side's block, so the incomingdescribehas to be re-inserted whole rather than resolved line by line.