Skip to content

Commit

Permalink
Skip the ETag header check in responce while using SSE-C encrpytion o…
Browse files Browse the repository at this point in the history
…f S3
  • Loading branch information
fuke committed Jul 7, 2014
1 parent 1ac79d0 commit 4ad9ac2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions boto/s3/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,10 +950,13 @@ def should_retry(self, response, chunked_transfer=False):
if isinstance(md5, bytes):
md5 = md5.decode('utf-8')

if self.etag != '"%s"' % md5:
raise provider.storage_data_error(
'ETag from S3 did not match computed MD5. '
'%s vs. %s' % (self.etag, self.md5))
# If you use customer-provided encryption keys, the ETag value that Amazon S3 returns in the response will not be the MD5 of the object.
server_side_encryption_customer_algorithm = response.getheader('x-amz-server-side-encryption-customer-algorithm', None)
if server_side_encryption_customer_algorithm is None:
if self.etag != '"%s"' % md5:
raise provider.storage_data_error(
'ETag from S3 did not match computed MD5. '
'%s vs. %s' % (self.etag, self.md5))

return True

Expand Down Expand Up @@ -1438,7 +1441,7 @@ def get_file(self, fp, headers=None, cb=None, num_cb=10,
headers/values that will override any headers associated
with the stored object in the response. See
http://goo.gl/EWOPb for details.
:type version_id: str
:param version_id: The ID of a particular version of the object.
If this parameter is not supplied but the Key object has
Expand Down Expand Up @@ -1667,7 +1670,7 @@ def get_contents_to_filename(self, filename, headers=None,
headers/values that will override any headers associated
with the stored object in the response. See
http://goo.gl/EWOPb for details.
:type version_id: str
:param version_id: The ID of a particular version of the object.
If this parameter is not supplied but the Key object has
Expand Down

0 comments on commit 4ad9ac2

Please sign in to comment.