HDDS-15600. Fix ListObjects response for encoding-type, empty delimiter, and control-character prefix#10586
Open
Gargi-jais11 wants to merge 3 commits into
Open
HDDS-15600. Fix ListObjects response for encoding-type, empty delimiter, and control-character prefix#10586Gargi-jais11 wants to merge 3 commits into
Gargi-jais11 wants to merge 3 commits into
Conversation
…rol-character prefix
adoroszlai
reviewed
Jun 23, 2026
adoroszlai
left a comment
Contributor
There was a problem hiding this comment.
Thanks @Gargi-jais11 for the patch.
chungen0126
approved these changes
Jun 30, 2026
chungen0126
left a comment
Contributor
There was a problem hiding this comment.
Thanks @Gargi-jais11 for working on this. Overall, looks good to me. Just a nit.
| // This allows us to seek directly to the first key with the right prefix. | ||
| seekKey = getOzoneKey(volumeName, bucketName, | ||
| StringUtils.isNotBlank(keyPrefix) ? keyPrefix : OM_KEY_PREFIX); | ||
| (keyPrefix != null && !keyPrefix.isEmpty()) ? keyPrefix : OM_KEY_PREFIX); |
Contributor
There was a problem hiding this comment.
We can use StringUtils.isNotEmpty() to simplify this condition.
|
|
||
| String seekPrefix; | ||
| if (StringUtils.isNotBlank(keyPrefix)) { | ||
| if (keyPrefix != null && !keyPrefix.isEmpty()) { |
Contributor
There was a problem hiding this comment.
We can use StringUtils.isNotEmpty() to simplify this condition.
| ListObjectResponse response = new ListObjectResponse(); | ||
| response.setDelimiter(EncodingTypeObject.createNullable(delimiter, encodingType)); | ||
| // AWS omits Delimiter from the response when the client passes delimiter= or does not specify delimiter at all. | ||
| if (delimiter != null && !delimiter.isEmpty()) { |
Contributor
There was a problem hiding this comment.
We can use StringUtils.isNotEmpty() to simplify this condition.
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.
What changes were proposed in this pull request?
Ozone S3 Gateway fails s3-tests ListObjects cases that AWS S3 passes:
test_bucket_list_encoding_basic— With EncodingType=url, keys and CommonPrefixes containing spaces are encoded with + (Java URLEncoder form encoding) instead of AWS-style %20.Example: prefix quux ab/ is returned as quux+ab/ but should be quux%20ab/.
test_bucket_list_delimiter_empty— When Delimiter='' is sent, listing behavior is correct (all keys returned, no CommonPrefixes), but the response incorrectly includes a Delimiter field. AWS omits Delimiter from the XML when the client passes an empty delimiter.test_bucket_list_prefix_unreadable— ListObjects with Prefix='\x0a' (newline) should echo the prefix in the response and return empty Contents/CommonPrefixes. Ozone may not preserve or echo the control-character prefix correctly.https://ozone.s3.peterxcli.dev/#latest-run-section
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15600
How was this patch tested?
Before fix:
3 echoed prefix always url-encoded:
After fix: