You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2022/05/18 11:08:45 UTC

[libcloud] 06/09: make content-type header is optional to work with S3 servers that not support content-type header

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 1bacb9f73cfed4305346372a3732da5c0702a6a1
Author: Sergey Matvienko <sm...@thingsboard.io>
AuthorDate: Tue May 17 18:13:25 2022 +0300

    make content-type header is optional to work with S3 servers that not support content-type header
---
 libcloud/storage/drivers/s3.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py
index 50fdc20d5..3dc4237e2 100644
--- a/libcloud/storage/drivers/s3.py
+++ b/libcloud/storage/drivers/s3.py
@@ -1193,7 +1193,12 @@ class BaseS3StorageDriver(StorageDriver):
 
     def _headers_to_object(self, object_name, container, headers):
         hash = headers.get("etag", "").replace('"', "")
-        extra = {"content_type": headers["content-type"]}
+
+        extra = {}
+
+        if "content-type" in headers:
+            extra["content_type"] = headers["content-type"]
+
         if "etag" in headers:
             extra["etag"] = headers["etag"]