Preserve source object metadata during multipart copy #6989
Conversation
|
|
||
| CreateMultipartUploadRequest request = SdkPojoConversionUtils.toCreateMultipartUploadRequest(copyObjectRequest); | ||
|
|
||
| // Preserve source metadata for multipart copy since CreateMultipartUpload has no MetadataDirective support. |
There was a problem hiding this comment.
Should we check == COPY instead? What if there's a new enum added in the future where metadata is not supposed to be passed
- Updated to COPY
Should we add all common fields of CreateMultipartUploadRequest and headObjectResponse? This way, we don't risk missing new fields
- HeadObjectResponse and CreateMultipartUploadRequest share fields (e.g. ServerSideEncryption, SSEKMSKeyId, StorageClass) that are already set from the customer's CopyObjectRequest via setSdkFields, overwriting those from HeadObject would be changing during copy. An explicit allow list should be good I guess. This matches what PHP and CLI forward.
There was a problem hiding this comment.
Can we update javadoc to mention this copy metadata by default behavior?
|
|
||
| CreateMultipartUploadRequest request = SdkPojoConversionUtils.toCreateMultipartUploadRequest(copyObjectRequest); | ||
|
|
||
| // Preserve source metadata for multipart copy since CreateMultipartUpload has no MetadataDirective support. |
There was a problem hiding this comment.
Can we update javadoc to mention this copy metadata by default behavior?
| @@ -380,6 +385,107 @@ private void stubSuccessfulCompleteMultipartCall() { | |||
| .thenReturn(completeMultipartUploadFuture); | |||
| } | |||
|
|
|||
| @Test | |||
| void multiPartCopy_metadataDirectiveUnset_shouldForwardSourceMetadata() { | |||
There was a problem hiding this comment.
Can we make this paramaterized test and add a test case metadataDirective set to COPY?
|
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |
Motivation and Context
When the multipart-enabled S3 client copies an object, it uses CreateMultipartUpload + UploadPartCopy instead of a single CopyObject call. Unlike CopyObject, CreateMultipartUpload has no MetadataDirective support, so when a customer explicitly set MetadataDirective.COPY, the directive was silently ignored and source object metadata was dropped on the destination.
Modifications
Testing
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License