{ "id": "105498", "key": "TIMOB-12394", "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": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2013-03-18T18:40:37.000+0000", "created": "2012-11-26T14:03:45.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [ { "id": "26775", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "108428", "key": "TIMOB-13101", "fields": { "summary": "Mobile Web: properties 'file' and 'nativePath' are not set when Blob is returned from HTTPClient", "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": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-06-19T12:42:39.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": "The Titanium documentation [implies|http://docs.appcelerator.com/titanium/2.1/#!/api/Titanium.Utils-method-base64encode] that Mobile Web Blobs store their data in the Base64 form:\r\n\r\n{quote}On Mobile Web, if obj is a [Titanium.Blob] containing binary data, then obj is returned unmodified because the binary blob is already base64 encoded.{quote}\r\n\r\nHowever, the current implementation of Ti.Blob on Mobile Web does not seem to apply Base64 encoding/decoding. Also, Titanium.Network.HTTPClient returns unencoded blobs (with raw binary data). \r\n\r\nA short code example follows. Expected behavior: 'xhr.responseData' is Base64-encoded. Actual behavior: 'xhr.responseData' is not Base64-encoded.\r\n\r\n{code} var xhr = Titanium.Network.createHTTPClient();\r\n \r\n xhr.onload = function()\r\n {\r\n var blob = xhr.responseData; // should be Base64-encoded, but isn't\r\n \r\n // Loading image from blob to an image view will fail, because \"blob\" is not Base64-encoded\r\n // imageView1.image = blob;\r\n };\r\n \r\n downloadButton.addEventListener('click',function() {\r\n xhr.open('GET','/images/a-logo.png');\r\n xhr.file = Ti.Filesystem.applicationDataDirectory + 'a-logo.png';\r\n xhr.send();\r\n });{code}", "attachment": [ { "id": "35070", "filename": "HttpClient.zip", "author": { "name": "eduard", "key": "eduard", "displayName": "Eduard Serdyuk", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-23T14:39:18.000+0000", "size": 3693756, "mimeType": "application/zip" } ], "flagged": false, "summary": "Mobile Web: Ti.Blob does not do Base64 encoding/decoding as specified in the docs", "creator": { "name": "ypidstryhach_gl", "key": "ypidstryhach_gl", "displayName": "Yaroslav Pidstryhach", "active": true, "timeZone": "Europe/Helsinki" }, "subtasks": [], "reporter": { "name": "ypidstryhach_gl", "key": "ypidstryhach_gl", "displayName": "Yaroslav Pidstryhach", "active": true, "timeZone": "Europe/Helsinki" }, "environment": "MS Windows, Titanium Studio 3.0.0.201211202053, SDK 3.0.0, Chrome simulator or a Webkit mobile browser", "comment": { "comments": [ { "id": "234799", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Can you attach a test case?", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-17T14:49:50.000+0000", "updated": "2013-01-17T14:49:50.000+0000" }, { "id": "234905", "author": { "name": "eduard", "key": "eduard", "displayName": "Eduard Serdyuk", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This example checks Blob`s properties: responseData, file, nativePath\r\n\r\nExpected behavior:'responseData' will be Base64-encoded,'file' and 'nativePath' will not be undefined.\r\n\r\nActual behavior: 'responseData' is not Base64-encoded, 'file' and 'nativePath' are undefined.\r\n\r\n{code}\r\nvar xhr = Titanium.Network.createHTTPClient();\r\n\t\r\n\txhr.onload = function()\r\n\t{\r\n\t\tvar blob = xhr.responseData;\r\n\t\t\r\n\t\tTi.API.info('Blob with Base64-encoded data:'+blob);\r\n\t\t\r\n\t\t//Load image from blob to ImageView1\r\n\t\timageView1.image = blob;\r\n\t\t\r\n\t\t//Check properties 'file' and 'nativePath' of Blob\r\n\t\t//Properties 'file' and 'nativePath' aren`t set in current HttpClient \r\n\t\tif (!!blob.file) {\r\n\t\t\t\r\n\t\t\tTi.API.info('File name:'+blob.nativePath);\r\n\t\t\t\r\n\t\t\t//load data from file to ImageView2\r\n\t\t\timageView2.image = blob.file.read();\t\r\n\t\t} else {\r\n\t\t\tTi.API.info(\"Property 'file' is missing\");\r\n\t\t}\r\n\t\t\r\n\t};\r\n\t\r\n\tdownloadButton.addEventListener('click',function() {\r\n\t\txhr.open('GET','/images/a-logo.png');\r\n\t\txhr.file = Ti.Filesystem.applicationDataDirectory + 'a-logo.png';\r\n\t\txhr.send();\r\n\t});\r\n{code}", "updateAuthor": { "name": "eduard", "key": "eduard", "displayName": "Eduard Serdyuk", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-18T06:06:55.000+0000", "updated": "2013-01-21T12:49:30.000+0000" }, { "id": "235218", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Your test case is incomplete. imageView1 and imageView2 are never defined or created. Please attach a complete test case that I can run without modification", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-21T18:13:33.000+0000", "updated": "2013-01-21T18:13:33.000+0000" }, { "id": "235226", "author": { "name": "eduard", "key": "eduard", "displayName": "Eduard Serdyuk", "active": true, "timeZone": "America/Los_Angeles" }, "body": "See attachments : ImageLoader1.zip\n", "updateAuthor": { "name": "eduard", "key": "eduard", "displayName": "Eduard Serdyuk", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-21T18:30:18.000+0000", "updated": "2013-01-21T18:30:18.000+0000" }, { "id": "235276", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The attached test case does not work in iOS. HTTPClient cannot connect because there is no server to connect to. The test case must work in iOS (and Android) so I can compare with Mobile Web.", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-22T00:07:31.000+0000", "updated": "2013-01-22T00:07:31.000+0000" }, { "id": "235492", "author": { "name": "eduard", "key": "eduard", "displayName": "Eduard Serdyuk", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Attached is an improved demo for this bug. The pre-fix and post-fix behavior was verified on:\r\n\r\n- Mobile Web in MacOS (10.8.2, Safari);\r\n- Android 4.0.4 device;\r\n- Android 2.3 emulator;\r\n- iOS 6 simulator.\r\n\r\nPlease refer to the comments in the app.js source code file for more info.", "updateAuthor": { "name": "eduard", "key": "eduard", "displayName": "Eduard Serdyuk", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-23T14:39:18.000+0000", "updated": "2013-01-23T14:39:18.000+0000" }, { "id": "235510", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "For reference, we always add a link to the PR in the JIRA ticket. Please make sure to do so in the future.\n\nPR: https://github.com/appcelerator/titanium_mobile/pull/3693", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-23T17:27:24.000+0000", "updated": "2013-01-23T17:27:24.000+0000" }, { "id": "235557", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The attached test case forks for mobile web vs iphone. That makes the comparison invalid. You need to remove all forks so that the exact same code runs on both platforms.", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-23T20:03:00.000+0000", "updated": "2013-01-23T20:03:00.000+0000" }, { "id": "235566", "author": { "name": "ypidstryhach_gl", "key": "ypidstryhach_gl", "displayName": "Yaroslav Pidstryhach", "active": true, "timeZone": "Europe/Helsinki" }, "body": "The fork is inevitable:\r\n\r\n# Browsers will generally not open (via XMLHttpRequest) remote files from a domain that's different from the domain hosting the application. So we cannot use a public URL, and must supply a local image URL (unless you host the MW app on the public server as well).\r\n\r\n# On the other hand, there's no way to use a local image URL on an Apple device (with an URL that would also work in Mobile Web).\r\n\r\nThat's why we supply different URLs for different platforms. Note that the difference does not affect the functionality we're proposing to fix (Blob encoding and missing properties).", "updateAuthor": { "name": "ypidstryhach_gl", "key": "ypidstryhach_gl", "displayName": "Yaroslav Pidstryhach", "active": true, "timeZone": "Europe/Helsinki" }, "created": "2013-01-23T20:24:37.000+0000", "updated": "2013-01-23T20:35:18.000+0000" }, { "id": "235568", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "You can open remote files that have CORS enabled in MW", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-23T20:36:01.000+0000", "updated": "2013-01-23T20:36:01.000+0000" }, { "id": "235706", "author": { "name": "ypidstryhach_gl", "key": "ypidstryhach_gl", "displayName": "Yaroslav Pidstryhach", "active": true, "timeZone": "Europe/Helsinki" }, "body": "Thanks. The sample is now updated as you requested. I cannot attach it, though, because I lack the permissions on the new location (TIMOB). I will contact you via email.", "updateAuthor": { "name": "ypidstryhach_gl", "key": "ypidstryhach_gl", "displayName": "Yaroslav Pidstryhach", "active": true, "timeZone": "Europe/Helsinki" }, "created": "2013-01-24T13:47:24.000+0000", "updated": "2013-01-24T13:47:24.000+0000" }, { "id": "235741", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "In your sample app you have the following line: \r\n{code}\r\nTi.API.info('Blob with Base64-encoded data:'+blob);\r\n{code}\r\nIn iOS this gives the following output:\r\n{code}\r\n[INFO] Blob with Base64-encoded data:[object TiBlob]\r\n{code}\r\nI'm not sure why the toString() method isn't doing something more interesting on iOS (bug perhaps?), but it nonetheless means we can't compare results. You'll need to find another way to demonstrate the parity issue.", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-24T18:45:04.000+0000", "updated": "2013-01-24T18:45:29.000+0000" }, { "id": "236173", "author": { "name": "ypidstryhach_gl", "key": "ypidstryhach_gl", "displayName": "Yaroslav Pidstryhach", "active": true, "timeZone": "Europe/Helsinki" }, "body": "In the pull request you commented: \r\n\r\n\"I dug into this issue a little more, and, in short, the wrong thing was fixed. HTTPClient works just fine, and Blob mostly works just fine (there are some issues with toString, but that is unrelated to this issue). The bug is in ImageView. We don't base64 encode blobs anymore, so imageview needs to be updated to base64 encode the data from blobs.\"\r\n\r\nThen it looks like documentation for base64encode should be updated, because it implies that blobs are always base64 encoded.", "updateAuthor": { "name": "ypidstryhach_gl", "key": "ypidstryhach_gl", "displayName": "Yaroslav Pidstryhach", "active": true, "timeZone": "Europe/Helsinki" }, "created": "2013-01-28T13:41:53.000+0000", "updated": "2013-01-28T13:41:53.000+0000" }, { "id": "236239", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yeah, that couldn't hurt, although to be honest it shouldn't matter that much because Blob is supposed to be a black box, and it doesn't matter to users how it's implemented.", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-28T17:58:09.000+0000", "updated": "2013-01-28T17:58:09.000+0000" }, { "id": "242714", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Bryan/Yaroslav, what are the next steps for this issue? Is this still a docs problem, or will a new pull request need to be made? Cheers.", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-18T18:31:43.000+0000", "updated": "2013-03-18T18:31:43.000+0000" }, { "id": "242716", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Duplicate of TIMOB-12416", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-18T18:40:37.000+0000", "updated": "2013-03-18T18:40:37.000+0000" } ], "maxResults": 17, "total": 17, "startAt": 0 } } }