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
🐛 [FIREBASE_STORAGE] mime/contentType undefined after upploading files to firebase storage #12363
Comments
Thanks for the report @pureimpro
|
thank you @darshankawar for your time and effort. you are right, the plugin example provided does the job (I have also tested on Android).
However, if you DO NOT provide SettableMetadata, or if you provide SettableMetadata WITHOUT contentType attribute, the uploaded file WILL NOT have any contentType. I have tested with .jpg image files, with the example plugin. The type of the file is not inferred from the file extension, neither defaults to application/octet-stream, as expected from the documentation : https://firebase.google.com/docs/storage/flutter/upload-files#add_file_metadata Add File Metadata |
Thanks for the update. |
Thanks for the report. I'll have a look. |
thank you @Lyokone for your time and effort. |
Bug report
Describe the bug
Undefined contentType after uploading a file to firebase storage (tested on Android)
The workaround is to manually set the contentType before upload, with SettableMetadata :
If you upload your file directly via the firebase console, contentType IS correctly recognized.
/!\ If your file is an image and you have a thumbnail generator cloudFunction for your bucket, no thumbnail for your image will be generated, since contentType is undefined.
Dart SDK 3.3.0
Flutter SDK 3.19.0
Debug mode
Steps to reproduce
Pickup a file with FilePicker and then firebaseStorageReference.putFile(), without any SettableMetadata:
Expected behavior
contentType automatically set corresponding to the file extension
Sample project
Additional context
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
The text was updated successfully, but these errors were encountered: