This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 5b15d61918ccc60c438cb1dde88fae2554c94455
Author: Veith Röthlingshöfer <[email protected]>
AuthorDate: Thu May 5 15:25:01 2022 +0200

    Fix crash on missing etag in s3 driver
---
 libcloud/storage/drivers/s3.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py
index d52630105..9973bdbd1 100644
--- a/libcloud/storage/drivers/s3.py
+++ b/libcloud/storage/drivers/s3.py
@@ -1192,8 +1192,10 @@ class BaseS3StorageDriver(StorageDriver):
         return content_length
 
     def _headers_to_object(self, object_name, container, headers):
-        hash = headers["etag"].replace('"', "")
-        extra = {"content_type": headers["content-type"], "etag": 
headers["etag"]}
+        hash = headers.get("etag", "").replace('"', "")
+        extra = {"content_type": headers["content-type"]}
+        if "etag" in headers:
+            extra["etag"] = headers["etag"]
         meta_data = {}
 
         if "content-encoding" in headers:

Reply via email to