{ "id": "93934", "key": "TIMOB-9806", "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": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2017-06-26T21:54:34.000+0000", "created": "2012-06-26T15:42:58.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "js", "parity" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [ { "id": "18083", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "93405", "key": "MOD-769", "fields": { "summary": "Cloud: Migrate drillbit tests to new Anvil format", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "updated": "2018-04-04T23:20:26.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "11500", "name": "MobileWeb", "description": "Mobile Web (HTML) Platform" } ], "description": "Attempting to send data where one of the properties is a blob will fail when making an HTTP client request on MobileWeb. An example of this is manifested when trying to upload a photo to ACS. \r\n\r\nThis issue was identified when running the updated ti.cloud Anvil tests.\r\n\r\nThis works on iOS and Android platforms. If you examine the source code on iOS and Android you will notice that there is special handling for blob properties.\r\n\r\nThe following example demonstrates the issue:\r\n{code}\r\nvar sessionID;\r\nvar apikey = '';\r\nvar userid = '';\r\nvar password = '';\r\nvar photoFileName = 'appcelerator.jpg'; // Replace with the name of an image file located in your Resources folder\r\n\r\nvar login = function() {\r\n var data = {\r\n login: userid,\r\n password: password\r\n }\r\n\t\r\n var xhr = Ti.Network.createHTTPClient({\r\n onerror: function(e) {\r\n Ti.API.error(\"ERROR\");\r\n },\r\n onload: function(e) {\r\n Ti.API.info(\"LOGGED IN\");\r\n var json = this.responseText;\r\n var data = JSON.parse(json);\r\n if (data && data.meta) {\r\n sessionID = data.meta.session_id;\r\n createPhoto();\r\n }\r\n }\r\n });\r\n\t\r\n xhr.open(\"POST\", \"https://api.cloud.appcelerator.com/v1/users/login.json?key=\" + apikey);\r\n xhr.send(data);\r\n}\r\n\r\nvar createPhoto = function() {\r\n var data = {\r\n photo: Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, photoFileName).read(),\r\n suppress_response_codes: 'true',\r\n };\r\n\t\r\n var xhr = Ti.Network.createHTTPClient({\r\n onerror: function(e) {\r\n Ti.API.error(\"ERROR\");\r\n },\r\n onload: function(e) {\r\n Ti.API.info(\"CREATED\");\r\n Ti.API.info(this.responseText);\r\n }\r\n });\r\n\t\r\n xhr.open(\"POST\", \"https://api.cloud.appcelerator.com/v1/photos/create.json?key=\" + apikey + \"&_session_id=\" + sessionID);\r\n xhr.send(data);\r\n}\r\n\r\nlogin();\r\n{code}", "attachment": [], "flagged": false, "summary": "MobileWeb: Parity issue with HTTPClient send data that contains a blob", "creator": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "environment": "SDK build: 2.1.0.v20120618104311\r\nModule: ti.cloud 2.1.0\r\nBrowsers: Chrome, Firefox, Safari", "comment": { "comments": [ { "id": "208187", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "The problem stems from Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, photoFileName).read() returning a Blob, which then invokes the Blob's toString() method. toString() on a blob will return a data uri with the binary image file base64 encoded.\r\n\r\nTo fix it, we need to update the urlEncode function in Ti._.lang to check if the value is a binary Ti.Blob, then base64 decode it and then uri encode it.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2012-07-17T15:37:56.000+0000", "updated": "2012-07-17T15:37:56.000+0000" }, { "id": "422843", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Resolving as \"Won't Fix\" as MobileWeb has been deprecated.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-06-26T21:54:34.000+0000", "updated": "2017-06-26T21:54:34.000+0000" }, { "id": "436371", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as will not fix.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-04-04T23:20:26.000+0000", "updated": "2018-04-04T23:20:26.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }