Is there an existing issue for this?
Which plugins are affected?
Storage
Which platforms are affected?
Web
Description
On flutter web, same issue fixed on android by #12363 and #12801
On Web, putFile function is not available (only compatible with android), so you have to use putData instead on a firebaseStorageRef.
When you FirebaseStorage.instance.ref().child(fileName).putData() with a NULL SettableMetadata, mime type is NOT correctly inferred from file extension in storage firebase console and defaults to application/octet-stream
If you provide any customMetadata to SettableMetadata (for example customMetadata: {'picked-file-path': file.path}) WITHOUT providing a contentType, mime type is also not inferred from file extension in firebase console
In all cases, if you do not provide a contentType to SettableMetadata, mime type is never inferred always defaults to application/octet-stream
Reproducing the issue
Use the firebase_storage package example https://pub.dev/packages/firebase_storage/example, with the following update :
final metadata = SettableMetadata(
contentType: 'image/jpeg', <<< COMMENT THIS LINE
customMetadata: {'picked-file-path': file.path},
);
Firebase Core version
4.0.0
Flutter Version
3.35.1
Relevant Log Output
Flutter dependencies
Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.
Additional context and comments
No response
Is there an existing issue for this?
Which plugins are affected?
Storage
Which platforms are affected?
Web
Description
On flutter web, same issue fixed on android by #12363 and #12801
On Web,
putFilefunction is not available (only compatible with android), so you have to useputDatainstead on a firebaseStorageRef.When you
FirebaseStorage.instance.ref().child(fileName).putData()with a NULL SettableMetadata, mime type is NOT correctly inferred from file extension in storage firebase console and defaults toapplication/octet-streamIf you provide any customMetadata to SettableMetadata (for example customMetadata: {'picked-file-path': file.path}) WITHOUT providing a
contentType, mime type is also not inferred from file extension in firebase consoleIn all cases, if you do not provide a contentType to SettableMetadata, mime type is never inferred always defaults to
application/octet-streamReproducing the issue
Use the firebase_storage package example https://pub.dev/packages/firebase_storage/example, with the following update :
final metadata = SettableMetadata(
contentType: 'image/jpeg', <<< COMMENT THIS LINE
customMetadata: {'picked-file-path': file.path},
);
Firebase Core version
4.0.0
Flutter Version
3.35.1
Relevant Log Output
Flutter dependencies
Expand
Flutter dependenciessnippetReplace this line with the contents of your `flutter pub deps -- --style=compact`.Additional context and comments
No response