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

put-object should set correct content-type #43

Closed
simonw opened this issue Dec 7, 2021 · 5 comments
Closed

put-object should set correct content-type #43

simonw opened this issue Dec 7, 2021 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@simonw
Copy link
Owner

simonw commented Dec 7, 2021

I got this working, but the files I upload with s3-credentials put-object all have Content-Type: binary/octet-stream.

Originally posted by @simonw in #42 (comment)

@simonw
Copy link
Owner Author

simonw commented Dec 7, 2021

I can guess the type from the file extension using mimetypes: https://docs.python.org/3/library/mimetypes.html#mimetypes.guess_type

@simonw
Copy link
Owner Author

simonw commented Dec 7, 2021

But for reading from stdin I will let the user set --content-type something instead.

@simonw
Copy link
Owner Author

simonw commented Dec 7, 2021

Prototype worked:

echo "<h1>Hello world" | \
  s3-credentials put-object simonwillison-public-bucket \
    -a public-bucket-creds.json hello.html - \
    --content-type text/html

http://s3.amazonaws.com/simonwillison-public-bucket/hello.html

This is for a bucket created using the new experimental --public-bucket option from:

@simonw simonw added the enhancement New feature or request label Dec 7, 2021
@simonw
Copy link
Owner Author

simonw commented Dec 7, 2021

I wrote an integration test for #42 which also covers this.

simonw added a commit that referenced this issue Dec 7, 2021
Will help with buckets as websites in #21

Includes integration test cowerage for put-object content-type in #43
@simonw
Copy link
Owner Author

simonw commented Dec 7, 2021

Added tests in 6e0a2c2

@simonw simonw closed this as completed Dec 7, 2021
simonw added a commit that referenced this issue Dec 7, 2021
@simonw simonw added this to the 1.0 milestone Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant