{ "id": "172236", "key": "TIMOB-26607", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2018-09-18T18:20:13.000+0000", "priority": null, "labels": [ "android", "engSchedule", "file" ], "versions": [ { "id": "20238", "description": "", "name": "Release 7.5.0", "archived": false, "released": true, "releaseDate": "2018-11-15" } ], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-06-25T15:38:39.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{code}\r\nvar win = Titanium.UI.createWindow();\r\nvar btn = Ti.UI.createButton({\r\n\ttitle: \"cam\"\r\n});\r\nwin.add(btn);\r\nbtn.addEventListener(\"click\", function() {\r\n\tTi.Media.showCamera({\r\n\t\tsuccess: function(e) {\r\n\t\t\toutputFile(e.media.file);\r\n\t\t},\r\n\t\tanimate: false\r\n\t});\r\n})\r\n\r\nfunction outputFile(f) {\r\n\tconsole.log(f.nativePath);\r\n\tconsole.log(f.directoryListing);\r\n\tif (f.parent!=null){\r\n\t\toutputFile(f.parent);\r\n\t}\r\n}\r\n\r\nwin.open();\r\n{code}\r\n\r\nNot sure if it's by design or needed somewhere but when you print out the media that is returned by the camera you'll find folder/file structure from your app up to the root folder:\r\n\r\nThe output from the above code on my phone will be:\r\n\r\n{code}\r\n{\r\n \"height\": 2368,\r\n \"type\": 1,\r\n \"mimeType\": \"image/jpeg\",\r\n \"text\": null,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data/com.miga.testcamera/cache/_tmp/tia737439898.jpg\",\r\n \"width\": 4208,\r\n \"length\": 2104961,\r\n \"file\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data/com.miga.testcamera/cache/_tmp/tia737439898.jpg\",\r\n \"name\": \"tia737439898.jpg\",\r\n \"symbolicLink\": false,\r\n \"size\": 2104961,\r\n \"directoryListing\": null,\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data/com.miga.testcamera/cache/_tmp\",\r\n \"name\": \"_tmp\",\r\n \"symbolicLink\": false,\r\n \"size\": 4096,\r\n \"directoryListing\": [\"tia737439898.jpg\", \"remote-cache\"],\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data/com.miga.testcamera/cache\",\r\n \"name\": \"cache\",\r\n \"symbolicLink\": false,\r\n \"size\": 4096,\r\n \"directoryListing\": [\"_tmp\"],\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data/com.miga.testcamera\",\r\n \"name\": \"com.miga.testcamera\",\r\n \"symbolicLink\": false,\r\n \"size\": 4096,\r\n \"directoryListing\": [\"cache\", \"files\"],\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data\",\r\n{code}\r\n\r\nthe next output will be all my folders on the SD card, then it will go up and show a warning\r\n{code}\r\nW/miga.testcamera: type=1400 audit(0.0:48590): avc: denied { read } for name=\"/\" dev=\"rootfs\" ino=1 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0\r\n{code} \r\nsince it's not rooted and can't access all the folders. So depending on your structure and the amount of folders you have the output will be very large. \r\nIt should stop at the app level if the information is not needed in any other place.\r\n\r\nSure on android you can change the folder via code but the JSON output is cut of because it's too big and that is not needed in this case I think.", "attachment": [], "flagged": false, "summary": "Android: Camera media json contains whole folder tree", "creator": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "449172", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~michael], this issue was resolved in Titanium 8.0.0.\r\n\r\nWe removed the \"directoryListing\" property from the {{Ti.Filesystem.File}} object. It's now a method instead that. So, doing a stringify on the object will no longer output the directory listing anymore.\r\nhttps://github.com/appcelerator/titanium_mobile/commit/39c330fc2d8730dcd31d5976f298289f963c2c57#diff-270689a7e55b3ec8920d9cfec7c0846a\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-18T17:28:36.000+0000", "updated": "2019-06-18T17:28:36.000+0000" }, { "id": "449173", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Yes, the directoryListing is gone but output with 8.0.1.GA is still\r\n{code}\r\n{\r\n \"y\": 0,\r\n \"x\": 0,\r\n \"height\": 2368,\r\n \"width\": 4208,\r\n \"media\": {\r\n \"height\": 2368,\r\n \"type\": 1,\r\n \"mimeType\": \"image/jpeg\",\r\n \"text\": null,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data/com.miga.testcamera/cache/_tmp/tia1364273087.jpg\",\r\n \"width\": 4208,\r\n \"length\": 1982269,\r\n \"size\": 9964544,\r\n \"file\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data/com.miga.testcamera/cache/_tmp/tia1364273087.jpg\",\r\n \"name\": \"tia1364273087.jpg\",\r\n \"symbolicLink\": false,\r\n \"size\": 1982269,\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data/com.miga.testcamera/cache/_tmp\",\r\n \"name\": \"_tmp\",\r\n \"symbolicLink\": false,\r\n \"size\": 4096,\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data/com.miga.testcamera/cache\",\r\n \"name\": \"cache\",\r\n \"symbolicLink\": false,\r\n \"size\": 4096,\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data/com.miga.testcamera\",\r\n \"name\": \"com.miga.testcamera\",\r\n \"symbolicLink\": false,\r\n \"size\": 4096,\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android/data\",\r\n \"name\": \"data\",\r\n \"symbolicLink\": false,\r\n \"size\": 4096,\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0/Android\",\r\n \"name\": \"Android\",\r\n \"symbolicLink\": false,\r\n \"size\": 4096,\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": true,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated/0\",\r\n \"name\": \"0\",\r\n \"symbolicLink\": false,\r\n \"size\": 4096,\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": false,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage/emulated\",\r\n \"name\": \"emulated\",\r\n \"symbolicLink\": false,\r\n \"size\": 4096,\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": {\r\n \"writable\": false,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///storage\",\r\n \"name\": \"storage\",\r\n \"symbolicLink\": false,\r\n \"size\": 100,\r\n \"hidden\": false,\r\n \"readonly\": true,\r\n \"parent\": {\r\n \"writable\": false,\r\n \"executable\": false,\r\n \"nativePath\": \"file:///\",\r\n \"name\": \"\",\r\n \"symbolicLink\": false,\r\n \"size\": 0,\r\n \"hidden\": false,\r\n \"readonly\": false,\r\n \"parent\": null,\r\n \"apiName\": \"Ti.Proxy\",\r\n \"bubbleParent\": true\r\n },\r\n \"apiName\": \"Ti.Proxy\",\r\n \"bubbleParent\": true\r\n },\r\n \"apiName\": \"Ti.Proxy\",\r\n \"bubbleParent\": true\r\n },\r\n \"apiName\": \"Ti.Proxy\",\r\n \"bubbleParent\": true\r\n },\r\n \"apiName\": \"Ti.Proxy\",\r\n \"bubbleParent\": true\r\n },\r\n \"apiName\": \"Ti.Proxy\",\r\n \"bubbleParent\": true\r\n },\r\n \"apiName\": \"Ti.Proxy\",\r\n \"bubbleParent\": true\r\n },\r\n \"apiName\": \"Ti.Proxy\",\r\n \"bubbleParent\": true\r\n },\r\n \"apiName\": \"Ti.Proxy\",\r\n \"bubbleParent\": true\r\n },\r\n \"apiName\": \"Ti.Proxy\",\r\n \"bubbleParent\": true\r\n },\r\n \"apiName\": \"Ti.Blob\",\r\n \"bubbleParent\": true\r\n },\r\n \"code\": 0,\r\n \"mediaType\": \"public.image\",\r\n \"cropRect\": {\r\n \"height\": 2368,\r\n \"width\": 4208,\r\n \"y\": 0,\r\n \"x\": 0\r\n },\r\n \"success\": true\r\n}\r\n{code}\r\n\r\nThe parent still goes up to file/// and leaving the app folder. The question is if that is necessary at all. ", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-06-18T17:47:09.000+0000", "updated": "2019-06-18T17:47:09.000+0000" }, { "id": "449184", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Oh... you're right.\r\n\r\nIt sounds like we need to set up the \"parent\" property as *not* enumerable.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-19T02:58:54.000+0000", "updated": "2019-06-19T02:58:54.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }