Skip to content

Commit

Permalink
Do not include sse configuration of source object in that of the dest…
Browse files Browse the repository at this point in the history
…ination object (#3016)
  • Loading branch information
matchbookmac committed May 5, 2024
1 parent c635205 commit c59f722
Show file tree
Hide file tree
Showing 3 changed files with 310 additions and 451 deletions.
4 changes: 3 additions & 1 deletion gems/aws-sdk-s3/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Fix bug where destination bucket default encryption was inadvertently overridden by source object encryption.

1.149.0 (2024-04-30)
------------------

Expand Down Expand Up @@ -167,7 +169,7 @@ Unreleased Changes
1.123.2 (2023-06-12)
------------------

* Issue - Fix issue when decrypting noncurrent versions of objects when using client side encryption (#2866).
* Issue - Fix issue when decrypting noncurrent versions of objects when using client side encryption (#2866).

1.123.1 (2023-06-02)
------------------
Expand Down
18 changes: 10 additions & 8 deletions gems/aws-sdk-s3/lib/aws-sdk-s3/object_multipart_copier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ def source_has_parts(options)
end

def source_metadata(options)
if options[:content_length]
return { content_length: options.delete(:content_length) }
end
return options.slice(:content_length) if options[:content_length]

client = options[:copy_source_client] || @client

Expand All @@ -150,11 +148,15 @@ def source_metadata(options)
bucket, key = options[:copy_source].match(/([^\/]+?)\/(.+)/)[1,2]
end

key = CGI.unescape(key)
opts = { bucket: bucket, key: key }
opts[:version_id] = version_id if version_id
opts[:part_number] = options[:part_number] if options[:part_number]
client.head_object(opts).to_h
head_opts = { bucket: bucket, key: CGI.unescape(key) }.tap { |opts|
opts[:version_id] = version_id if version_id
opts[:part_number] = options[:part_number] if options[:part_number]
}

client.head_object(head_opts).to_h.tap { |head|
head.delete(:server_side_encryption)
head.delete(:ssekms_key_id)
}
end

def default_part_size(source_size)
Expand Down

0 comments on commit c59f722

Please sign in to comment.