-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 SDK fails to autodetect content-type, sets everything to "application/octet-stream" #3085
Comments
Hey @distinctdan thank-you for reaching out to us with your issue. You are right about the way SDK adds the content type, it will add Since the SDK is not trying to detect the |
Hmm, well if it's not actually supported, the docs are specific to the javascript sdk, so it seems that they should be updated to reflect that this sdk doesn't do autodetection. It's really not a big deal to me that it doesn't, it's just that it's not documented, so I had to waste time trying to figure out what was going on. The docs are already specific to javascript, and this javascript sdk is different from some of the other sdk's in functionality, so making content-type a required property for this sdk shouldn't be a problem, since the reality is that it doesn't have the functionality that some other ones have. At the very least, it should be documented that content-type is not autodetected. I ended up using another library, https://www.npmjs.com/package/mime-types, to detect the types for my files; I don't know how open you guys are to requiring additional node modules in your repo.
|
Hey @distinctdan apologies that you have to go through the trouble. marking it required would mean that SDK should not result in successful call if the content-type is not mentioned. Which will mean to flag content-type in SDK as required as well which will be a breaking change for many of the customers. The correct way to do this could be to specify that if no contentType is passed it will default to |
Ok, I gotcha, that sounds good to me. |
Hi, I'm using this SDK for a S3 Compatible storage, they support autodetect content-type on their server side, is there any way to tell SDK don't send the Content-Type header rather than default to I know it is not a AWS question, but i will very much appreciate it if you willing to answer my question.. |
Well, I wasted almost a day because of this. My object displayed with Type column in S3 Console, I thought it had been auto-detected. |
@ajredniwja I might be tempted to work on this feature. Where's the best place to discuss the design of how it might work? I don't want to write all the code, only for the design to be unacceptable 😄 |
You might wanna check the AWS JAVA SDK implementation for this. |
Based on this discussion, the bolded is not applicable, right? |
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
The S3 sdk fails to autodetect the content-type of files uploaded through
s3.putObject
and defaults them to "application/octet-stream". There was a previous issue here: #2510, but the only solution given was to manually set the content type for every file. This is unreasonable because the docs imply the sdk is supposed to do this automatically. Out of all the examples on the docs here: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property, none of them manually specify a content type, so this is supposed to be working automatically.Is the issue in the browser/Node.js?
Node.js
If on Node.js, are you running this on AWS Lambda?
No
Details of the browser/Node.js version
Node v12.11.1
SDK version number
aws-sdk@2.610.0
To Reproduce (observed behavior)
The text was updated successfully, but these errors were encountered: