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.
Motivation
We've got a reported in our Community Slack channel about issue with trailing slashes, especially with short key name (single characters). The trailing slashes would be missing:
I wrote a test for it and I had a hunch it came from our custom logic to parse URI parameters. We had custom logic for S3 because our router strips trailing slashes by default. We would check if the key name is in the path, and then split on the key and check if the leftover characters in the path are all slashes, to keep them.
However, to do so, we would partition the path on the parse
Key
parameter. Printing the result showed quite quickly what was the issue:We would split/partition on the bucket name first while using path style. To avoid this, we need to start from the right side. That way, we properly get all the right side slashes.
Changes
Key
, but starting from the right