Skip to content

[Bug-Fix] Fix S3 multipart copy requiring s3:GetObjectVersion on versioned buckets#3867

Open
kai-ion wants to merge 3 commits into
mainfrom
Headobject
Open

[Bug-Fix] Fix S3 multipart copy requiring s3:GetObjectVersion on versioned buckets#3867
kai-ion wants to merge 3 commits into
mainfrom
Headobject

Conversation

@kai-ion

@kai-ion kai-ion commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Issue #, if available:

Description of changes:
Stop auto-pinning the HeadObject-derived versionId onto UploadPartCopy
requests in S3CrtClient::PopulateCopyObjectProperties. Rely on the ETag
conditional (x-amz-copy-source-if-match) for source consistency instead.

GetObjectAnnotation and GetObjectTagging continue to use versionId since
they don't support ETag conditionals.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

  Stop auto-pinning the HeadObject-derived versionId onto UploadPartCopy
  requests in S3CrtClient::PopulateCopyObjectProperties. Rely on the ETag
  conditional (x-amz-copy-source-if-match) for source consistency instead.

  GetObjectAnnotation and GetObjectTagging continue to use versionId since
  they don't support ETag conditionals.
// Detect source mutation via ETag conditional without requiring s3:GetObjectVersion.
// If the user explicitly provided sourceVersionId, it is already parsed above and preserved.
if (sourceVersionId.empty() && !head.GetVersionId().empty()) {
sourceVersionId = head.GetVersionId();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should remove this entire if statement. we want to honor the versionId set in the request, however not override it by the head response if it present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants