[TIMOB-26954] Android: Reading a JSON file fails on Android Q
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-06-13T18:33:40.000+0000 |
Affected Version/s | Release 8.0.0, Release 7.3.0 |
Fix Version/s | Release 8.1.0 |
Components | Android |
Labels | Blob, JSON, android, engSchedule |
Reporter | grebulon |
Assignee | Joshua Quick |
Created | 2019-03-14T14:39:17.000+0000 |
Updated | 2020-03-25T17:48:49.000+0000 |
Description
Running the following code, returns t==null
{quote}
var file=Ti.Filesystem.getFile(Config.PathRoot.resources,'some.json');
var d=file.read();
var t=d.text;
{quote}
Analysis:
TiBlob#getText checks TiMimeTypeHelper.isBinaryMimeType(mimetype) and if the file is binary, it only allows application/octet-stream. The detected mime type comes from android.webkit.MimeTypeMap#getMimeTypeFromExtension (in TiMimeTypeHelper#getMimeTypeFromFileExtension). This used to return the octet-steam mime on *.json files, but it was probably fixed to properly return application/json.
BTW, I fixed this in TiMimeTypeHelper#isBinaryMimeType {quote} if (mimeType.startsWith("application/") && !mimeType.endsWith("xml") && !mimeType.endsWith("json")) return true; else ... {quote} Not very comprehensive, but does the job
Thanks for sharing with us. Just following up to check the status of this case and if you need further help on it.
[~ahutton] Would you please check if you can repro this? I just spoke with [~jquick] and he suggested to do a quick check before scheduling this.
[~amukherjee] Reproducible.
There is also an issue on github from the Android team about this: https://github.com/appcelerator/titanium_mobile/issues/10852 with some log-data
PR (master): https://github.com/appcelerator/titanium_mobile/pull/10931
FR Passed. PR Merged.
PR (8.1.x): https://github.com/appcelerator/titanium_mobile/pull/10955
Backport merged.
Verified the fix on SDK 8.2.0.v20190612155743 and 8.1.0.v20190612160220. Works as expected. Closing
Hello, I am contacting you on behalf of ATOSS Software company. Our mobile application is built based on your framework entirely. The problem is the following: as you already know, android 10 was officially released a few days ago and some of our customers already have it. We received from them a lot of complaints in which they said that the application doesn't work anymore. We are reading a local JSON file and the problem described here reproduces here on our product. Unfortunately we are unable to change sdk from 7.5.2 (what we currently have) to 8.1.0 (which has the fix) in a time that is agreeable by the customers so this leave us with no option but the sdk patch. Could we please get a patch with this fix for SDK 7.5.2 ? We would greatly appreciate your support on this one! Thanks!
For anyone running into this, here a custom build thats 7.5.2-GA + this patch (nothing else): https://www.dropbox.com/s/pmsn9g9v7gqdkme/mobilesdk-7.5.2-osx.zip?dl=1