[firebase_storage] Fix putFile method's Content-Type auto-detection for iOS#1355
Conversation
|
Android's uploaded file URL:
For your information, if these lines commented out, plugins/packages/firebase_storage/example/lib/main.dart Lines 68 to 71 in 04d6f52 |
c4b48d7 to
ca24c82
Compare
putFile method's Content-Type auto-detection for iOSputFile method's Content-Type auto-detection for iOS
putFile method's Content-Type auto-detection for iOSca24c82 to
5024d12
Compare
There was a problem hiding this comment.
Thank you so much for this PR.
Could you please write a CHANGELOG and update pubspec.yaml for release?
It looks like it might be possible to update the integration test to include the test for the correct behavior here. Would you be willing to add that?
- `putFile` should use `putFile` iOS SDK method correctly - `putFile` uses file extension as Content-Type automatically if not specified
5024d12 to
4ba8dc1
Compare
- flutter#1355 (review) - ‘content-type’ was ‘application/octet-stream’ before this pull request
|
I've added commits:
Could you check that please? |
|
Thanks for the contribution! Since this is a pre-1.0 plugin and this bug fix doesn't affect the public API of the plugin, I'm updating the version to make it a patch change. |
…or iOS (#1355) * Use `putFile` iOS SDK method instead of `putData` for `putFile` - `putFile` should use `putFile` iOS SDK method correctly - `putFile` uses file extension as Content-Type automatically if not specified * Verify ‘content-type’ is ‘text/plain’ - flutter/plugins#1355 (review) - ‘content-type’ was ‘application/octet-stream’ before this pull request
…or iOS (#1355) * Use `putFile` iOS SDK method instead of `putData` for `putFile` - `putFile` should use `putFile` iOS SDK method correctly - `putFile` uses file extension as Content-Type automatically if not specified * Verify ‘content-type’ is ‘text/plain’ - flutter/plugins#1355 (review) - ‘content-type’ was ‘application/octet-stream’ before this pull request
putFileshould useputFileiOS SDK method correctlyputFileshould auto-detect Content-Type automatically by file extension if not specifiedI tested at this sample on iOS:
https://github.com/flutter/plugins/blob/master/packages/firebase_storage/example/lib/main.dart.
This uses
putFilehere:plugins/packages/firebase_storage/example/lib/main.dart
Line 66 in 04d6f52
Before this pull request
Uploaded file:
https://firebasestorage.googleapis.com/v0/b/flutter-firebase-plugins.appspot.com/o/text%2Ffoob3d87700-3260-11e9-d838-d7a1f7b2a3d4.txt
contentTypeisapplication/octet-stream, but this is unintended value becauseputFileshould auto-detectcontentTypeas written this document.In this case, the file's extension is
txt, socontentTypeshould beplain/text.After this pull request
Uploaded file:
https://firebasestorage.googleapis.com/v0/b/flutter-firebase-plugins.appspot.com/o/text%2Ffoo09aa2e30-3260-11e9-efe1-e3ed438ea03f.txt
contentTypeisplain/text, which is intended value.