Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 object does not always have a content type #331

Closed
georgeboot opened this issue May 11, 2023 · 0 comments · Fixed by #332
Closed

S3 object does not always have a content type #331

georgeboot opened this issue May 11, 2023 · 0 comments · Fixed by #332

Comments

@georgeboot
Copy link
Contributor

georgeboot commented May 11, 2023

Cloudpathlib expects all s3 objects to have a content type, however this is not always the case as content-type is not a required field and is part of the objects optional metadata. Please review https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html#object-metadata

Please review the below code:
https://github.com/drivendataorg/cloudpathlib/blob/28b2eb5dbba3ba5477284e1b432ac723f1a87f1b/cloudpathlib/s3/s3client.py#LL145C9-L145C49

This will result in a KeyError on that specific line.

From what I have seen, the content type is not even used by cloudpathlib, so my vote would be to ditch it.

georgeboot added a commit to georgeboot/cloudpathlib that referenced this issue May 11, 2023
jayqi pushed a commit that referenced this issue May 13, 2023
* Allow empty content type for s3 objects

Fixes #331

* Update s3client.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant