Huang Kuan Hao created HDDS-15852:
-------------------------------------

             Summary: CopyObject to the same key with x-amz-metadata-directive: 
REPLACE is rejected as an illegal self-copy
                 Key: HDDS-15852
                 URL: https://issues.apache.org/jira/browse/HDDS-15852
             Project: Apache Ozone
          Issue Type: Sub-task
            Reporter: Huang Kuan Hao
            Assignee: Huang Kuan Hao


A CopyObject request whose source and destination are the same key, carrying 
x-amz-metadata-directive: REPLACE (the canonical way to update an object's user 
metadata in place), is rejected by the S3 Gateway with 400 InvalidRequest: 
"This copy request is illegal because it is trying to copy an object to it self 
... without changing the object's metadata, storage class, ...".

AWS S3 permits a self-copy as long as at least one attribute is being changed — 
user metadata (x-amz-metadata-directive: REPLACE), tag set 
(x-amz-tagging-directive: REPLACE), storage class, encryption, or 
website-redirect location.

Ozone's self-copy guard only accounts for the storage-class case. In 
ObjectEndpoint.java, when source bucket/key equal destination bucket/key it 
throws whenever storageTypeDefault is true (i.e. no x-amz-storage-class 
header), ignoring the metadata and tagging directives entirely. As a result an 
in-place metadata (or tag) replacement is wrongly rejected, even though the 
guard's own message claims it only fires "without changing the object's 
metadata".

Expected: self-copy with x-amz-metadata-directive: REPLACE succeeds and 
replaces the user metadata.
Actual: 400 InvalidRequest.

Ref: [https://ozone.s3.peterxcli.dev/]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to