You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
s3api copy-object with --metadata-directive REPLACE appends the object metadata instead of replacing it
To Reproduce
Create an s3 object 'a' in bucket 'ttt':
DEV03 [/mmfs1/data/TISRC] :>vgaws s3api put-object --bucket ttt --key a
{
"ETag": "d41d8cd98f00b204e9800998ecf8427e"
}
Use copy-object to add some metadata 'xxx=111':
DEV03 [/mmfs1/data/TISRC] :>vgaws s3api copy-object --bucket ttt --key a --copy-source ttt/a --metadata xxx=111 --metadata-directive REPLACE
{
"CopyObjectResult": {
"ETag": "d41d8cd98f00b204e9800998ecf8427e",
"LastModified": "2024-09-06T14:36:12.484700956+01:00"
}
}
Use head-object to display the metadata:
DEV03 [/mmfs1/data/TISRC] :>vgaws s3api head-object --bucket ttt --key a
{
"Restore": "",
"LastModified": "Fri, 06 Sep 2024 14:36:12 GMT",
"ContentLength": 0,
"ETag": "d41d8cd98f00b204e9800998ecf8427e",
"ContentType": "binary/octet-stream",
"Metadata": {
"xxx": "111"
},
"StorageClass": "STANDARD"
}
Repeat the copy-object with some different metadata yyy=222 using the REPLACE directive:
DEV03 [/mmfs1/data/TISRC] :>vgaws s3api copy-object --bucket ttt --key a --copy-source ttt/a --metadata yyy=222 --metadata-directive REPLACE
{
"CopyObjectResult": {
"ETag": "d41d8cd98f00b204e9800998ecf8427e",
"LastModified": "2024-09-06T14:36:12.484700956+01:00"
}
}
Now repeat the head-object, it shows both metadata keys:
DEV03 [/mmfs1/data/TISRC] :>vgaws s3api head-object --bucket ttt --key a
{
"Restore": "",
"LastModified": "Fri, 06 Sep 2024 14:36:12 GMT",
"ContentLength": 0,
"ETag": "d41d8cd98f00b204e9800998ecf8427e",
"ContentType": "binary/octet-stream",
"Metadata": {
"xxx": "111", ##<<<<<<<<<<<<<<<< WRONG
"yyy": "222"
},
"StorageClass": "STANDARD"
}
If you try this on AWS s3 then the second metadata update overwrites the first and so only the second one is seen (ie yyy=222, not xxx=111).
Expected behavior
copy-object using the metadata-directive REPLACE option should erase/overwrite any existing metadata and show only the latest, ie it should behave the same as AWS s3
Server Version
git clone from 6 sep 24
Additional context
The text was updated successfully, but these errors were encountered:
When using the REPLACE directive, we were incorrectly removing the
old metadata on the object due to missing the metadata prefix on
the key. Fix this to remove the correct metadata before setting
new metadata.
Fixes#787
When using the REPLACE directive, we were incorrectly removing the
old metadata on the object due to missing the metadata prefix on
the key. Fix this to remove the correct metadata before setting
new metadata.
Fixes#787
When using the REPLACE directive, we were incorrectly removing the
old metadata on the object due to missing the metadata prefix on
the key. Fix this to remove the correct metadata before setting
new metadata.
Fixes#787
When using the REPLACE directive, we were incorrectly removing the
old metadata on the object due to missing the metadata prefix on
the key. Fix this to remove the correct metadata before setting
new metadata.
Fixes#787
Describe the bug
s3api copy-object with --metadata-directive REPLACE appends the object metadata instead of replacing it
To Reproduce
Create an s3 object 'a' in bucket 'ttt':
DEV03 [/mmfs1/data/TISRC] :>vgaws s3api put-object --bucket ttt --key a
{
"ETag": "d41d8cd98f00b204e9800998ecf8427e"
}
Use copy-object to add some metadata 'xxx=111':
DEV03 [/mmfs1/data/TISRC] :>vgaws s3api copy-object --bucket ttt --key a --copy-source ttt/a --metadata xxx=111 --metadata-directive REPLACE
{
"CopyObjectResult": {
"ETag": "d41d8cd98f00b204e9800998ecf8427e",
"LastModified": "2024-09-06T14:36:12.484700956+01:00"
}
}
Use head-object to display the metadata:
DEV03 [/mmfs1/data/TISRC] :>vgaws s3api head-object --bucket ttt --key a
{
"Restore": "",
"LastModified": "Fri, 06 Sep 2024 14:36:12 GMT",
"ContentLength": 0,
"ETag": "d41d8cd98f00b204e9800998ecf8427e",
"ContentType": "binary/octet-stream",
"Metadata": {
"xxx": "111"
},
"StorageClass": "STANDARD"
}
Repeat the copy-object with some different metadata yyy=222 using the REPLACE directive:
DEV03 [/mmfs1/data/TISRC] :>vgaws s3api copy-object --bucket ttt --key a --copy-source ttt/a --metadata yyy=222 --metadata-directive REPLACE
{
"CopyObjectResult": {
"ETag": "d41d8cd98f00b204e9800998ecf8427e",
"LastModified": "2024-09-06T14:36:12.484700956+01:00"
}
}
Now repeat the head-object, it shows both metadata keys:
DEV03 [/mmfs1/data/TISRC] :>vgaws s3api head-object --bucket ttt --key a
{
"Restore": "",
"LastModified": "Fri, 06 Sep 2024 14:36:12 GMT",
"ContentLength": 0,
"ETag": "d41d8cd98f00b204e9800998ecf8427e",
"ContentType": "binary/octet-stream",
"Metadata": {
"xxx": "111", ##<<<<<<<<<<<<<<<< WRONG
"yyy": "222"
},
"StorageClass": "STANDARD"
}
If you try this on AWS s3 then the second metadata update overwrites the first and so only the second one is seen (ie yyy=222, not xxx=111).
Expected behavior
copy-object using the metadata-directive REPLACE option should erase/overwrite any existing metadata and show only the latest, ie it should behave the same as AWS s3
Server Version
git clone from 6 sep 24
Additional context
The text was updated successfully, but these errors were encountered: