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

Multipart file upload content type #1648

Open
pacey opened this issue Jun 25, 2018 · 4 comments · May be fixed by #2672
Open

Multipart file upload content type #1648

pacey opened this issue Jun 25, 2018 · 4 comments · May be fixed by #2672
Labels
feature-request A feature should be added or improved. help wanted We are asking the community to submit a PR to resolve this issue.

Comments

@pacey
Copy link

pacey commented Jun 25, 2018

It looks like the normal putObject method on the S3 client will add a content-type header for you if one is missing. This is super helpful and I couldn't see this behaviour in the initiateMultipartUpload method. All the files I've uploaded end up having the content-type set to application/octet-stream

I'm currently using the AmazonS3 interface via the https://github.com/spring-cloud/spring-cloud-aws project and it's not possible to set the ObjectMetadata there.

Would it be possible to add this functionality to the initiateMultipartUpload method, as I can see the rest api supports that header?

@rafael-adcp
Copy link

Hey i found some work arounds for this, you can either call the s3 rest api directly which will work properly, or you can provide the content type when you initiate the multipart upload

eg:

//setting object metadata to have your file content type
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentType("video/mp4");

// Initiate the multipart upload.
InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest(
    bucket,
    key,
    objectMetadata
);

code to uploadPart and also to complete remains the same

@debora-ito
Copy link
Member

@pacey @rafael-adcp

Just a quick update letting you know that the SDK team has reviewed the feature request list for V1 and this looks like a great candidate for a community PR, which we’ll help merge in and support.

@pacey
Copy link
Author

pacey commented Sep 6, 2019

I can have a stab at it @debora-ito

@debora-ito debora-ito added help wanted We are asking the community to submit a PR to resolve this issue. and removed needs-contributors labels Feb 24, 2020
@JasonVoss
Copy link

I would like help in contributing for this issue. Please message me if you have any questions. I can begin working on it.

JasonVoss pushed a commit to JasonVoss/aws-sdk-java that referenced this issue Nov 21, 2021
JasonVoss pushed a commit to JasonVoss/aws-sdk-java that referenced this issue Nov 22, 2021
JasonVoss pushed a commit to JasonVoss/aws-sdk-java that referenced this issue Nov 22, 2021
@JasonVoss JasonVoss linked a pull request Nov 22, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. help wanted We are asking the community to submit a PR to resolve this issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants