-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Firebase Storage image upload ignores contentType metadata #739
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
Comments
@arminsal1 Thanks for this - I believe the RNFirebase iOS library is detecting the underlying content type automatically and overriding your setting. We'll investigate. |
@chrisbianca I discovered some info that may help with debugging this issue! I found that I can upload a gif from a "file://" uri and setting the metadata will treat it as such, so the problem appears to just be with uploading a gif from a "asset-library://" uri. I know gifs from asset-library on iOS never animate in React Native's |
Thanks for reporting this issue. We're aware that Storage has fallen behind slightly on React Native Firebase and would like to bring it up to speed again. I will close this issue for now and track it as well as other issues collectively over on the Storage improvements proposal to be addressed in a future release. See #1260 |
@arminsal1 @EvanBacon have fixed this in my local branch, mime types are automatically detected correctly now on both platforms and can also be overridden as above (though you won't need to do as above now as it'll be correct by default) Will be part of 4.3.0 - thanks for reporting! Will do a pre-release soon, would be great if you could test it. |
Fix for this is now live in the v4.3.0 release. Loving
|
@Salakar Thanks for all the work and improvements you put into this library! It's easily the most well-maintained and stable library I've had the pleasure of using in my react native projects. I migrated to v4.3.6 successfully and attempted uploading a few files to test the storage fix. The .jpeg and .mov files had accurate MIME types, but the .gif continues to have a 'image/jpeg' MIME type when uploaded and doesn't animate. 😕 Here's what my upload code looks like:
I tested multiple gif files that animate when I view them in my camera roll and after uploading them on other non-react apps, but they all keep the image/jpeg MIME type for some reason. Here's a screenshot of what I see in my storage console: I tested this on the iOS Simulator running the latest stable build of Xcode and iOS 11, and my physical iPhone running the latest iOS 12 beta If there's any more info I can give to help lemme know! |
@arminsal1 looks like it's this code in the Whats your thoughts on it automatically doing that - personally I don't think it should be converting any files as it's out-of-scope of Firebase Storage - just not sure if anyone needs that, would be a breaking change to remove it if so. For the time being, I think I can tweak it to check for Hei/c specifically only and convert just those. Give me an hour and I'll see if I can get some sort of patch pushed up - hard to test as tests don't go through camera roll (directly test file paths) of which that logic is for, unfortunately. Loving
|
@arminsal1 right, fixed - 3rd times the charm they say 😄 v4.3.7 published with this in, please update and rebuild iOS and let me know how you get on. Thanks Loving
|
@Salakar 3rd times the charm indeed, this fix did the job! With regards to the library handling file conversion, I think the extent to which you currently have it is a good middle ground. I don't think there are many cases where further conversions would be necessary and the setup as is appears to cover any needs I personally would have. :) |
Issue
I'm trying to upload gifs from my app, but the content type is uploaded as image/jpeg even though I explicitly set it to image/gif when uploading a custom metadata.
My Code:
this.state.image
is the uri retrieved from React Native Camera Roll Picker. I checked the logic and the app is detecting that it's a gif. It sets the extension properly, but the contentType when I check on the firebase console is image/jpeg, which causes the gif to not be playable.Environment
The text was updated successfully, but these errors were encountered: