Skip to content

Commit c59f722

Browse files
authored
Do not include sse configuration of source object in that of the destination object (#3016)
1 parent c635205 commit c59f722

File tree

3 files changed

+310
-451
lines changed

3 files changed

+310
-451
lines changed

gems/aws-sdk-s3/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Unreleased Changes
22
------------------
33

4+
* Issue - Fix bug where destination bucket default encryption was inadvertently overridden by source object encryption.
5+
46
1.149.0 (2024-04-30)
57
------------------
68

@@ -167,7 +169,7 @@ Unreleased Changes
167169
1.123.2 (2023-06-12)
168170
------------------
169171

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

172174
1.123.1 (2023-06-02)
173175
------------------

gems/aws-sdk-s3/lib/aws-sdk-s3/object_multipart_copier.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ def source_has_parts(options)
138138
end
139139

140140
def source_metadata(options)
141-
if options[:content_length]
142-
return { content_length: options.delete(:content_length) }
143-
end
141+
return options.slice(:content_length) if options[:content_length]
144142

145143
client = options[:copy_source_client] || @client
146144

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

153-
key = CGI.unescape(key)
154-
opts = { bucket: bucket, key: key }
155-
opts[:version_id] = version_id if version_id
156-
opts[:part_number] = options[:part_number] if options[:part_number]
157-
client.head_object(opts).to_h
151+
head_opts = { bucket: bucket, key: CGI.unescape(key) }.tap { |opts|
152+
opts[:version_id] = version_id if version_id
153+
opts[:part_number] = options[:part_number] if options[:part_number]
154+
}
155+
156+
client.head_object(head_opts).to_h.tap { |head|
157+
head.delete(:server_side_encryption)
158+
head.delete(:ssekms_key_id)
159+
}
158160
end
159161

160162
def default_part_size(source_size)

0 commit comments

Comments
 (0)