{ "id": "160225", "key": "TIMOB-23422", "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": [ { "id": "17706", "name": "Release 5.4.0", "archived": false, "released": true, "releaseDate": "2016-08-11" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-05-31T14:17:48.000+0000", "created": "2016-05-12T21:06:06.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "titanium", "windows", "windows8.1" ], "versions": [], "issuelinks": [], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2016-06-29T22:05:37.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": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "h2. Problem\r\n\r\nWhen using Ti.Network.createHTTPclient to submit files Windows sends non-nonsensical repeating combination of \"%00%00%00%00%00%00%00%00%00%\" for the file instead of blob/base64 file. Other values appear to be corrupted as well. iOS & Android perform as expected and submit a parse-able muli-part form data. This issue is stopping us from going live on windows...\r\n\r\nh2. Test Case\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar url = 'https://wul06jzgd0yn.runscope.net'; //use favorite inspector here...\r\n\r\nfunction go() {\r\n Titanium.Media.showCamera({\r\n\r\n mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],\r\n success: function(event) {\r\n\r\n if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {\r\n\r\n var newId = new Date().getTime();\r\n var newName = 'HEY_YOU_GUYS_WAIT_FOR_ME-' + newId;\r\n var fileName = newName + '.jpg';\r\n var imageFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, fileName);\r\n imageFile.write(event.media);\r\n console.log(imageFile.nativePath);\r\n\r\n var client = Ti.Network.createHTTPClient({\r\n onload: function(e) {\r\n alert('success');\r\n },\r\n onerror: function(err) {\r\n alert('error');\r\n }\r\n });\r\n\r\n client.open(\"POST\", url);\r\n\r\n var f = {\r\n name: newName,\r\n attachment: imageFile.read(imageFile)\r\n };\r\n client.send(f);\r\n }\r\n\r\n },\r\n cancel: function() {\r\n console.log('camera cancel');\r\n },\r\n error: function(error) {\r\n console.log('camera error');\r\n }\r\n\r\n });\r\n\r\n}\r\n\r\ngo();\r\n\r\n{code}\r\n\r\nh2. Discussions\r\n\r\nExpect windows to perform as iOS & Android do. \r\n", "attachment": [], "flagged": false, "summary": "Windows: Submission of files/images is broken on Windows 8.1 & Windows 10", "creator": { "name": "kdclaw3@gmail.com", "key": "kdclaw3@gmail.com", "displayName": "Dee Clawson", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "kdclaw3@gmail.com", "key": "kdclaw3@gmail.com", "displayName": "Dee Clawson", "active": true, "timeZone": "America/New_York" }, "environment": "Ti SDK: 5.3.0.v20160509143032\r\nBuilding for Windows, iOS & Android", "closedSprints": [ { "id": 631, "state": "closed", "name": "2016 Sprint 11 SDK", "startDate": "2016-05-21T00:06:10.029Z", "endDate": "2016-06-04T00:06:00.000Z", "completeDate": "2016-06-06T07:30:39.854Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "385731", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\n\r\nThanks for reporting. We really appreciate your contribution. However I am not actually able to reproduce this issue yet. It will be appreciated if you provide full test code and steps also explain the issue a bit more.\r\n\r\nThanks in advance", "updateAuthor": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2016-05-15T06:15:37.000+0000", "updated": "2016-05-15T06:15:37.000+0000" }, { "id": "385736", "author": { "name": "kdclaw3@gmail.com", "key": "kdclaw3@gmail.com", "displayName": "Dee Clawson", "active": true, "timeZone": "America/New_York" }, "body": "The issue is well defined, when submitting a file it is not submitting a base64 encoded file it is submitting something and unknown encoding. Is it hex? Why? It's not base64. I have no idea what it is submitting. The full code to replicate the issue is attached. Please review the code under Test Case titled app.js. The code runs on Windows, iOS & Android without error and should be beyond simple to replicate the problem. \r\n\r\n1. It launches the camera. \r\n2. It takes a picture and submit's it to a web service of your choosing. \r\n\r\nYou will need to define a web service inspector of you choosing at the beginning of the code. Our enterprise uses runscope but there are free ones like requestb.in\r\n\r\n", "updateAuthor": { "name": "kdclaw3@gmail.com", "key": "kdclaw3@gmail.com", "displayName": "Dee Clawson", "active": true, "timeZone": "America/New_York" }, "created": "2016-05-15T13:11:34.000+0000", "updated": "2016-05-15T13:17:16.000+0000" }, { "id": "385781", "author": { "name": "kdclaw3@gmail.com", "key": "kdclaw3@gmail.com", "displayName": "Dee Clawson", "active": true, "timeZone": "America/New_York" }, "body": "The code will alert success that it has successfully called the service, please don't confuse that with it actually submitting that is coherent. You will need to inspect the call to see that is broken. I suppose you could use something like Charles or Fiddler to proxy the call and inspect it as well. ", "updateAuthor": { "name": "kdclaw3@gmail.com", "key": "kdclaw3@gmail.com", "displayName": "Dee Clawson", "active": true, "timeZone": "America/New_York" }, "created": "2016-05-16T11:43:05.000+0000", "updated": "2016-05-16T11:43:05.000+0000" }, { "id": "385892", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\n\r\nI am able to reproduce this issue.\r\n\r\n*Steps:*\r\n\r\n1. Create a default classic project for windows and android.\r\n\r\n2. Replace code in app.js with following.\r\n{code}\r\nvar url = 'http://requestb.in/v0rea5v0';\r\n//use favorite inspector here...\r\n\r\n\r\nfunction go() {\r\n\r\n\tTitanium.Media.openPhotoGallery({\r\n\r\n\t\tmediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],\r\n\r\n\t\tsuccess : function(event) {\r\n\r\n\t\t\tif (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {\r\n\r\n\t\t\t\tvar newId = new Date().getTime();\r\n\r\n\t\t\t\tvar newName = 'HEY_YOU_GUYS_WAIT_FOR_ME-' + newId;\r\n\r\n\t\t\t\tvar fileName = newName + '.jpg';\r\n\r\n\t\t\t\tvar imageFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, fileName);\r\n\r\n\t\t\t\timageFile.write(event.media);\r\n\r\n\t\t\t\tconsole.log(imageFile.nativePath);\r\n\r\n\t\t\t\tvar client = Ti.Network.createHTTPClient({\r\n\r\n\t\t\t\t\tonload : function(e) {\r\n\t\t\t\r\n\t\t\t\t\t\talert('success');\r\n\t\t\t\t\t\r\n\r\n\t\t\t\t\t},\r\n\r\n\t\t\t\t\tonerror : function(err) {\r\n\r\n\t\t\t\t\t\talert('error');\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\t\tclient.open(\"POST\", url);\r\n\r\n\t\t\t\tvar f = {\r\n\r\n\t\t\t\t\tname : newName,\r\n\r\n\t\t\t\t\tattachment : imageFile.read(imageFile)\r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t\tclient.send(f);\r\n\r\n\t\t\t}\r\n\r\n\t\t},\r\n\r\n\t\tcancel : function() {\r\n\r\n\t\t\tconsole.log('camera cancel');\r\n\r\n\t\t},\r\n\r\n\t\terror : function(error) {\r\n\r\n\t\t\tconsole.log(JSON.stringify(error));\r\n\r\n\t\t}\r\n\t});\r\n\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\nTitanium.UI.setBackgroundColor('#fff');\r\n\r\nvar win = Titanium.UI.createWindow({\r\n\ttitle : 'win',\r\n\tbackgroundColor : '#fff'\r\n});\r\n\r\nvar label = Ti.UI.createLabel({\r\n color:'blue',\r\n text:'Take Photo',\r\n width: 300, height: 200\r\n});\r\n\r\nlabel.addEventListener('click',function(e){\r\n\tgo();\r\n});\r\n\r\n//win.addEventListener('open',function(e){\r\n//\tgo();\r\n//});\r\nwin.add(label);\r\n\r\nwin.open();\r\n{code}\r\n\r\n3. Add following portion in tiapp.xml.\r\n{code}\r\n\r\n \t\r\n\t \r\n\t \t\r\n\t \t\r\n\t \t\r\n\t \r\n\t \r\n \r\n \r\n{code}\r\n\r\n4. Build and run.\r\n5. Click \"Take Photo\" >> Select a photo from gallery. \r\n6. Wait for the photo to be uploaded. \r\n7. After success alert see data in server.\r\n\r\nFor android in {{http://requestb.in}} uploaded data is well recognized for name and raw body.\r\n*name:*\r\n{code}\r\nname: HEY_YOU_GUYS_WAIT_FOR_ME-1463482381085\r\n{code}\r\n*raw body:*\r\n{code}\r\n--nlHtuDQAML8XdKemqPHuELR9izAPAfsUgfD9tNU\r\nContent-Disposition: form-data; name=\"name\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\nHEY_YOU_GUYS_WAIT_FOR_ME-1463482381085\r\n--nlHtuDQAML8XdKemqPHuELR9izAPAfsUgfD9tNU\r\nContent-Disposition: form-data; name=\"attachment\"; filename=\"tixhr-2077574746.jpeg\"\r\nContent-Type: image/jpeg\r\nContent-Transfer-Encoding: binary\r\n(--data here--)\r\n{code}\r\nFor Windows name is corrupted and raw body is not well recognised.\r\n*name:*\r\n{code}\r\nname: H\u001bPu$\u001bPu\u0001�\u0001� Ou\r\n{code}\r\n*raw body:*\r\n{code}\r\n--e3ff3ff5-7d40-4f5e-9321-7086a4cb55de\r\nContent-Length: 2417376\r\nContent-Disposition: form-data; name=\"attachment\"\r\n{code}\r\n\r\nThanks\r\n\r\n*Environment*:\r\n\r\n*Device info:* Nexus7 (android 6.0.1), Microsoft Lumia 640(Windows Phone 8.1)\r\n*Node.js Version:* 0.12.7\r\n*npm Version:* 2.11.3\r\n*Titanium SDKs:* 5.3.0.v20160404105211\r\n*Java Development Kit Version:* 1.8.0_73\r\n*Titanium CLI Version:* 5.0.5\r\n*Appcelerator CLI Version:* 5.2.2\r\n*Appcelerator Studio:* 4.5.0", "updateAuthor": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2016-05-17T11:10:30.000+0000", "updated": "2016-05-17T11:10:30.000+0000" }, { "id": "385937", "author": { "name": "kdclaw3@gmail.com", "key": "kdclaw3@gmail.com", "displayName": "Dee Clawson", "active": true, "timeZone": "America/New_York" }, "body": "Link to Appcelerator documentation on file uploads and downloads with similar example code. \r\n\r\nhttp://docs.appcelerator.com/platform/latest/#!/guide/File_Uploads_and_Downloads", "updateAuthor": { "name": "kdclaw3@gmail.com", "key": "kdclaw3@gmail.com", "displayName": "Dee Clawson", "active": true, "timeZone": "America/New_York" }, "created": "2016-05-17T19:55:11.000+0000", "updated": "2016-05-17T19:55:11.000+0000" }, { "id": "386526", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "https://github.com/appcelerator/titanium_mobile_windows/pull/713", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-05-23T20:05:45.000+0000", "updated": "2016-05-23T20:05:45.000+0000" }, { "id": "389474", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Verified using:\r\n\r\n\r\nWindows 10 Pro\r\nTi SDK: 5.4.0.v20160629063537\r\nAppc NPM: 4.2.7-2 \r\nAppc CLI: 5.4.0-23\r\nAppc Studio: 4.7.0.201606220541\r\nLumia 930: 10.0\r\nLumia 520: 8.1\r\n\r\nImages can now be submitted on Windows and the data sent matches that of an application built to Android.\r\n\r\nClosing ticket", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2016-06-29T22:05:32.000+0000", "updated": "2016-06-29T22:05:32.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }