Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18194] Android: blob does not recognize filenames with "@" as images including Retina

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.4.0, Release 3.4.1
Fix Version/sn/a
ComponentsAndroid
LabelsTCSupportTriage, android, blob, mimeType
ReporterJoe Falcone
AssigneeUnknown
Created2014-10-11T13:54:48.000+0000
Updated2018-02-28T19:54:49.000+0000

Description

Problem Description

If you read a Retina image (with filenames ending in @2x.png or @3x.png) into a blob, the blob does not recognize it as an image because the @ character somehow interferes with the getMimeTypeFromExtension call.

Steps to reproduce

1. Create a new mobile project (Classic Titanium) 2. In your project, copy Resources/KS_nav_ui.png into Resources/KS_nav_ui@2x.png 3. Paste this code into app.js:
var picture1 = 'KS_nav_ui@2x.png';
var file1 = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, picture1);
var blob1 = file1.read();
Ti.API.info('blob: ' + JSON.stringify(blob1, null, 2));
 
var picture2 = 'KS_nav_ui.png';
var file2 = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, picture2);
var blob2 = file2.read();
Ti.API.info('blob: ' + JSON.stringify(blob2, null, 2));
 
4. Run it into a device 5. Check the output in Ti Studio

Expected results

Since both files have the same content, should be reported as such.

Actual Results

Here are the specific results for the same file (KS_nav_ui.png which was copied to KS_nav_ui@2x.png) note that length is OK, and the data is OK, but height, width and mimeType are wrong:
ARN] :   V8Object: (KrollRuntimeThread) [77,77] Runtime disposed, cannot set property 'userAgent'
[WARN] :   TiBaseFile: (KrollRuntimeThread) [88,165] Method is not supported org.appcelerator.titanium.io.TiResourceFile : getParent
[INFO] :   TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.negoapps.arrobainfiles.ArrobainfilesActivity@294bd39a
[INFO] :   I/Adreno-EGL: <qeglDrvAPI_eglInitialize:410>: QUALCOMM Build: 10/24/14, 167c270, I68fa98814b
[INFO] :   OpenGLRenderer: Initialized EGL, version 1.4
[INFO] :   blob: {
[INFO] :   "file": {
[INFO] :   "hidden": false,
[INFO] :   "nativePath": "file:///android_asset/Resources/KS_nav_ui@2x.png",
[INFO] :   "writable": false,
[INFO] :   "executable": false,
[INFO] :   "parent": null,
[INFO] :   "readonly": true,
[INFO] :   "directoryListing": [],
[INFO] :   "size": 748,
[INFO] :   "apiName": "Ti.Proxy",
[INFO] :   "name": "KS_nav_ui@2x.png",
[INFO] :   "symbolicLink": false,
[INFO] :   "bubbleParent": true
[INFO] :   },
[INFO] :   "nativePath": "file:///android_asset/Resources/KS_nav_ui@2x.png",
[INFO] :   "height": 0,
[INFO] :   "length": 748,
[INFO] :   "width": 0,
[INFO] :   "mimeType": "application/octet-stream",
[INFO] :   "apiName": "Ti.Blob",
[INFO] :   "text": "�PNG\r\n\u001a\n\u0000\u0000\u0000\rIHDR\u0000\u0000\u0000.\u0000\u0000\u0000+\b\u0004\u0000\u0000\u0000�}r\u000f\u0000\u0000\u0002�IDATx\u0001���K[w\u001c��wrbj4\u000f.Y�ώ�m0��VŶ^�����E��boZ)�B�@��\u0016Z(\u0005ױ��bc�bs �֋R��m�I��.>������41�$�s�\u0010\u0016�\f<�]5�/���Ë\u001f|?�c�L\u0011}�\"��Y���G�>��������e\u0014s����w�\u0006<wr�p�G6�{\u0014'\u0005eӉ\u0007��*�\u0005��\u0016����p�A��\nZ��;�$�nq�N�Pp[|2���z-\u0015�~r5\u0002\u001f��Z���\u000e@æ\r�ڗĪ�x���Y��=��dO�~a\\h�bH\u0012��Z\u0007@��!�5vb�J�]����\u0001�z�\u000b)�\u0006c\u00147���{_\r[�+G���N��<���@��.�O� ��\u0018\r.\u0007\u001d,�B6�sp\u0003���\u0018�!���3K\u001a\u000b2\u0011C�U\u001c\u0016U\f�{%pG��Б3d>�j��ؖ�sZ�p��<���\u001aV�\u0002M\u00183\u0017P\u0005��٨\u0002�S��Z�\u000b�$��mQ�\u0006.U��\u001e��B[\b\r\u0006�~�rM�\u001eG4��v�\u0018\u001ee��\u0004�L�Lf�q�*vf��wN\nޜ�\b#� \u0005��\u001c��OV)+�K�\u001dl\u0019���k]�Q?=���-��\"��\u001b�\u00161�]w�^��x����7�k7Vq}�Z\"����j@�RM\"Z\tƼ��lb�~}����>�=\u001a���k�ªh[�~{��\u0012'�\u0010���r�Xw\u0005z�\\�:�::��%�=Y\t44�-�Z����\u0005�V���EA�\u001a�$=:\u0016�\u001cN\u000e�=�<�I:�\b�Y<���~�0�\u0014S���Q\u001e�\u0013\u0012f�\u0012'j\u0016W����EܐW�HnP%\u0012�9\u0000\u0000\u0000\u0000IEND�B`�",
[INFO] :   "type": 1,
[INFO] :   "bubbleParent": true
[INFO] :   }
[WARN] :   TiBaseFile: (KrollRuntimeThread) [278,278] Method is not supported org.appcelerator.titanium.io.TiResourceFile : getParent
[INFO] :   blob: {
[INFO] :   "file": {
[INFO] :   "hidden": false,
[INFO] :   "nativePath": "file:///android_asset/Resources/KS_nav_ui.png",
[INFO] :   "writable": false,
[INFO] :   "executable": false,
[INFO] :   "parent": null,
[INFO] :   "readonly": true,
[INFO] :   "directoryListing": [],
[INFO] :   "size": 748,
[INFO] :   "apiName": "Ti.Proxy",
[INFO] :   "name": "KS_nav_ui.png",
[INFO] :   "symbolicLink": false,
[INFO] :   "bubbleParent": true
[INFO] :   },
[INFO] :   "nativePath": "file:///android_asset/Resources/KS_nav_ui.png",
[INFO] :   "height": 43,
[INFO] :   "length": 748,
[INFO] :   "width": 46,
[INFO] :   "mimeType": "image/png",
[INFO] :   "apiName": "Ti.Blob",
[INFO] :   "text": null,
[INFO] :   "type": 1,
[INFO] :   "bubbleParent": true
[INFO] :   }

Extra info

This used to be a problem if you tried to open a Retina image in a webView but that has apparently been fixed so the mechanism a webView uses to determine mimeType seems to work.

Attachments

FileDateSize
RetinaTest.zip2014-10-11T13:54:48.000+00001647825

Comments

No comments

JSON Source