Skip to content

HDDS-15618. Fix ListObjects to include single whitespace-only S3 object keys#10589

Open
Gargi-jais11 wants to merge 1 commit into
apache:masterfrom
Gargi-jais11:HDDS-15618
Open

HDDS-15618. Fix ListObjects to include single whitespace-only S3 object keys#10589
Gargi-jais11 wants to merge 1 commit into
apache:masterfrom
Gargi-jais11:HDDS-15618

Conversation

@Gargi-jais11

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

s3-tests test_bucket_create_special_key_names fails because a key named **' '** is created but not returned by ListObjects. OmMetadataManagerImpl.getOzoneKey() uses StringUtils.isNotBlank(), which treats whitespace-only keys as absent, so the object is stored under /volume/bucket instead of /volume/bucket/.
List object uses prefix /volume/bucket/, so the key is omitted. Fix key encoding to allow whitespace-only names

Expected: [' ', '"', '$', '%', '&', "'", '<', '>', '_', '_ ', '_ _', '__']
Actual:   ['"', '$', '%', '&', "'", '<', '>', '_', '_ ', '_ _'] 

  # missing leading ' '

At index 0: ' ' != '"' 

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15618

How was this patch tested?

Added unit test.

@Gargi-jais11 Gargi-jais11 marked this pull request as ready for review June 23, 2026 08:28
@Gargi-jais11 Gargi-jais11 added the s3 S3 Gateway label Jun 23, 2026

@priyeshkaratha priyeshkaratha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Gargi-jais11 for the patch. Changes LGTM

@ivandika3 ivandika3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Gargi-jais11 , left one comment.

Comment on lines +1311 to +1313
for (int i = 0; i < keyNames.size(); i++) {
addKeysToOM(volumeName, bucketName, keyNames.get(i), i);
}

@ivandika3 ivandika3 Jun 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if we actually have an S3 integration test to prove that Ozone actually accepts a blank key (I'm not sure if it does). If OM does not accept a blank key, then the S3 single white space case will never be exercised.

@chungen0126

Copy link
Copy Markdown
Contributor

Thanks @Gargi-jais11 for working on this.

As far as I know, HDFS doesn't support filenames with spaces. I'm concerning about how this change impact that. Have you looked into it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

s3 S3 Gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants