fix: root at s3 upload part copy - #1247
Conversation
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Coverage Report for CI Build 29779999775Coverage remained the same at 79.556%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
There was a problem hiding this comment.
LGTM. Simple, correct fix that wraps the UploadPartCopy response in the CopyPartResult root element, matching the S3 API spec and the pattern already used elsewhere in this file (e.g. copyObject -> CopyObjectResult).
Extended reasoning...
Overview
This PR touches a single method (uploadPartCopy) in src/storage/protocols/s3/s3-handler.ts, changing the shape of the responseBody returned to the XML serializer so the wire response is wrapped in a CopyPartResult root tag instead of emitting bare ETag/LastModified fields. The test file was updated to issue a raw signed HTTP request and assert on the actual XML text (root tag name, presence of <ETag>/<LastModified>, closing tag), rather than relying on the AWS SDK's lenient parsing, which previously masked the missing root element.
Security risks
None. This is a pure response-shape fix with no changes to auth, input parsing, or data access. The values being serialized (ETag, LastModified) are already computed upstream and unchanged.
Level of scrutiny
Low. This is a narrowly scoped, mechanical fix aligning one endpoint's response format with the S3 API spec and with sibling methods in the same file that already follow this root-tag convention (CopyObjectResult, ListPartsResult, InitiateMultipartUploadResult, etc). The change is a straightforward object-nesting edit plus a regression test that directly exercises the wire format, giving good confidence the fix is correct.
Other factors
No CODEOWNER-restricted or auth/crypto-sensitive code is touched. The updated test is a meaningful improvement since it now validates the actual XML rather than the SDK's parsed representation.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
S3 upload part copy response doesn't set root tag name correct.
What is the new behavior?
It sets now and regression test validates the wire.
SDK doesn't care about root tag but might not be compatible with strict clients.
Additional context
S3 docs