Browse code

Fixes bug in PR #611

Florent Viard authored on 2015/09/18 02:24:26
Showing 1 changed files
... ...
@@ -1281,7 +1281,7 @@ class S3(object):
1281 1281
 
1282 1282
         debug("MD5 sums: computed=%s, received=%s" % (md5_computed, response["headers"]["etag"]))
1283 1283
         ## when using KMS encryption, MD5 etag value will not match
1284
-        if (response["headers"]["etag"].strip('"\'') != md5_hash.hexdigest()) and response["headers"]["x-amz-server-side-encryption"] != 'aws:kms':
1284
+        if (response["headers"]["etag"].strip('"\'') != md5_hash.hexdigest()) and response["headers"].get("x-amz-server-side-encryption") != 'aws:kms':
1285 1285
             warning("MD5 Sums don't match!")
1286 1286
             if retries:
1287 1287
                 warning("Retrying upload of %s" % (filename))
... ...
@@ -1480,9 +1480,8 @@ class S3(object):
1480 1480
             warning("Reported size (%s) does not match received size (%s)" % (
1481 1481
                 start_position + long(response["headers"]["content-length"]), response["size"]))
1482 1482
         debug("ReceiveFile: Computed MD5 = %s" % response.get("md5"))
1483
-        debug("sse headers : %s" % response["headers"]["x-amz-server-side-encryption"])
1484 1483
         # avoid ETags from multipart uploads that aren't the real md5
1485
-        if ('-' not in md5_from_s3 and not response["md5match"]) and (response["headers"]["x-amz-server-side-encryption"] != 'aws:kms'):
1484
+        if ('-' not in md5_from_s3 and not response["md5match"]) and (response["headers"].get("x-amz-server-side-encryption") != 'aws:kms'):
1486 1485
             warning("MD5 signatures do not match: computed=%s, received=%s" % (
1487 1486
                 response.get("md5"), md5_from_s3))
1488 1487
         return response