Skip to content
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

[Crash] putFile will crash when extension in unknown #4661

Closed
Maxoos opened this issue Dec 9, 2020 · 5 comments · Fixed by #4676
Closed

[Crash] putFile will crash when extension in unknown #4661

Maxoos opened this issue Dec 9, 2020 · 5 comments · Fixed by #4676
Labels
impact: crash Behaviour causing app to crash. platform: ios plugin: storage Firebase Cloud Storage Priority: P1 Workflow: Waiting for User Response Blocked waiting for user response.

Comments

@Maxoos
Copy link
Contributor

Maxoos commented Dec 9, 2020

I'm running xcode12 on Apple Silicon and it seems that pathExtension which used to return the extensions of the file in path is returning nil on iOS14 simulators (for gif files - does not happen on iOS13). This is probably a simulator issue, however, this code does not check if UTI is null and therefor crashes when trying to release:

CFRelease(UTI);

CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
(__bridge CFStringRef) [localFilePath pathExtension],
NULL);
CFStringRef mimeType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType);
CFRelease(UTI);

It should be something like:

if (UTI) { CFRelease(UTI); }

Return value can be null according to the documentation:

Return Value
A new CFStringRef containing a uniform type identifier, or NULL if inTagClass is not a known tag class

@mikehardy
Copy link
Collaborator

Oh my! Good catch @Maxoos - if you could work up a PR for this (for small patches I start by just modifying the file directly in node_modules then doing a patch-package for it) so you know it is tested and working and fixes your failure case, I'd happily merge it

@mikehardy mikehardy added impact: crash Behaviour causing app to crash. platform: ios plugin: storage Firebase Cloud Storage Workflow: Waiting for User Response Blocked waiting for user response. Priority: P1 Type: Invertase labels Dec 9, 2020
@fongabc
Copy link

fongabc commented Dec 14, 2020

I have the same issue on Apple Silicon

@fongabc
Copy link

fongabc commented Dec 14, 2020

I have the same issue on Apple Silicon

I found out that the issue occurs on simulator but not in the physical device.

@mikehardy
Copy link
Collaborator

I would still love to fix this for the simulator if someone worked up a PR for it and submitted it here. I don't have Apple Silicon so I cannot test it to verify if it's working, I will need someone from the community to propose it and verify it works for them

@Maxoos
Copy link
Contributor Author

Maxoos commented Dec 15, 2020

@mikehardy I've created a PR, I think you might be able to test this on an Intel based Mac by trying a file with no extension. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact: crash Behaviour causing app to crash. platform: ios plugin: storage Firebase Cloud Storage Priority: P1 Workflow: Waiting for User Response Blocked waiting for user response.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants