From ec0cf5d6ff5b08607452cabf10d0d76c600d6c62 Mon Sep 17 00:00:00 2001 From: George Boot <884482+georgeboot@users.noreply.github.com> Date: Thu, 11 May 2023 16:30:21 +0200 Subject: [PATCH 1/2] Allow empty content type for s3 objects Fixes #331 --- cloudpathlib/s3/s3client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudpathlib/s3/s3client.py b/cloudpathlib/s3/s3client.py index 474f4a88..ea3d8502 100644 --- a/cloudpathlib/s3/s3client.py +++ b/cloudpathlib/s3/s3client.py @@ -142,7 +142,7 @@ def _get_metadata(self, cloud_path: S3Path) -> Dict[str, Any]: "last_modified": data["LastModified"], "size": data["ContentLength"], "etag": data["ETag"], - "content_type": data["ContentType"], + "content_type": data["ContentType"] or None, "extra": data["Metadata"], } From 710c07ebb240f2ed87ed3fce829bda2864c01672 Mon Sep 17 00:00:00 2001 From: George Boot <884482+georgeboot@users.noreply.github.com> Date: Thu, 11 May 2023 16:34:24 +0200 Subject: [PATCH 2/2] Update s3client.py --- cloudpathlib/s3/s3client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudpathlib/s3/s3client.py b/cloudpathlib/s3/s3client.py index ea3d8502..1e698608 100644 --- a/cloudpathlib/s3/s3client.py +++ b/cloudpathlib/s3/s3client.py @@ -142,7 +142,7 @@ def _get_metadata(self, cloud_path: S3Path) -> Dict[str, Any]: "last_modified": data["LastModified"], "size": data["ContentLength"], "etag": data["ETag"], - "content_type": data["ContentType"] or None, + "content_type": data.get("ContentType", None), "extra": data["Metadata"], }