durch / rust-s3

Rust library for interfacing with S3 API compatible services
MIT License
498 stars 195 forks source link

*_with_content_type functions not setting content type on S3 #312

Open Qwertie- opened 1 year ago

Qwertie- commented 1 year ago

Describe the bug It seems that the put_object_with_content_type and put_object_stream_with_content_type methods are not setting the content type for uploaded objects on S3

To Reproduce A minimal test which shows the issue

use s3::{bucket::Bucket, creds::Credentials};
use tokio::fs::File;
#[tokio::main]
async fn main() {
    let mut file = File::open("/path/to/image.jpg")
        .await
        .unwrap();
    let region: s3::Region = "us-west-2".parse().unwrap();
    let credentials = Credentials::default().unwrap();
    let bucket = Bucket::new("bucket-name", region, credentials).unwrap();
    let content_type = "image/jpeg";

    bucket
        .put_object_stream_with_content_type(&mut file, "test/file2", content_type)
        .await;
}

Expected behavior I would expect this to show image/jpeg on the AWS web ui but instead it shows

Screenshot 2022-11-09 at 09 24 35

Environment