Skip to content

HDDS-15607. Return x-amz-meta-* user-defined object metadata on S3 GetObject#10785

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

HDDS-15607. Return x-amz-meta-* user-defined object metadata on S3 GetObject#10785
Gargi-jais11 wants to merge 1 commit into
apache:masterfrom
Gargi-jais11:HDDS-15607

Conversation

@Gargi-jais11

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

s3-tests test_object_set_get_metadata_* fail with KeyError:'meta1'.
PutObject stores custom metadata via getCustomMetadataFromHeaders(), and HeadObject returns it via addCustomMetadataHeaders(), but GetObject does not."

  • test_object_set_get_metadata_none_to_good
  • test_object_set_get_metadata_none_to_empty
  • test_object_set_get_metadata_overwrite_to_empty
  • test_object_set_get_unicode_metadata

Fix:
AddedaddCustomMetadataHeaders() to the GET response builder.

What is the link to the Apache JIRA

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

How was this patch tested?

Added IT and UT.
Before Fix:

bash-5.1$ aws s3api put-object \
  --bucket metatest \
  --key foo \
  --body /tmp/bar \
  --metadata meta1=mymeta \
  --endpoint-url http://s3g:9878
{
    "ETag": "\"c157a79031e1c40f85931829bc5fc552\""
}
bash-5.1$ aws s3api get-object \
  --bucket metatest \
  --key foo \
  /tmp/out \
  --endpoint-url http://s3g:9878 \
  --query 'Metadata'
                <------------------------- Didn't return the metadata tag
  
bash-5.1$ aws s3api put-object \
  --bucket metatest \
  --key foo2 \
  --body /tmp/bar \
  --metadata meta1= \
  --endpoint-url http://s3g:9878
{
    "ETag": "\"c157a79031e1c40f85931829bc5fc552\""
}
bash-5.1$ aws s3api get-object \
  --bucket metatest \
  --key foo2 \
  /tmp/out2 \
  --endpoint-url http://s3g:9878 \
  --query 'Metadata'
                 <------------------------- Didn't return the metadata tag

After Fix:

bash-5.1$ aws s3api put-object \
  --bucket metatest \
  --key foo \
  --body /tmp/bar \
  --metadata meta1=mymeta \
  --endpoint-url http://s3g:9878/
{
    "ETag": "\"c157a79031e1c40f85931829bc5fc552\""
}
bash-5.1$ aws s3api get-object \
  --bucket metatest \
  --key foo \
  /tmp/out \
  --endpoint-url http://s3g:9878/ \
  --query 'Metadata'
{
    "meta1": "mymeta"
}
bash-5.1$ aws s3api put-object \
  --bucket metatest \
  --key foo2 \
  --body /tmp/bar \
  --metadata meta1= \
  --endpoint-url http://s3g:9878/
{
    "ETag": "\"c157a79031e1c40f85931829bc5fc552\""
}
bash-5.1$ aws s3api get-object \
  --bucket metatest \
  --key foo2 \
  /tmp/out2 \
  --endpoint-url http://s3g:9878/ \
  --query 'Metadata'
{
    "meta1": ""
}

@ivandika3
ivandika3 requested a review from xichen01 July 17, 2026 04:41
@Gargi-jais11
Gargi-jais11 marked this pull request as ready for review July 17, 2026 04:43
@Gargi-jais11 Gargi-jais11 added the s3 S3 Gateway label Jul 17, 2026
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.

1 participant