{ "id": "159823", "key": "TIMOB-23309", "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": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-07-11T06:48:45.000+0000", "created": "2016-04-26T10:20:46.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "Android" ], "versions": [ { "id": "17706", "name": "Release 5.4.0", "archived": false, "released": true, "releaseDate": "2016-08-11" }, { "id": "17707", "name": "Release 5.3.0", "archived": false, "released": true, "releaseDate": "2016-06-04" } ], "issuelinks": [], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2016-08-16T22:05:35.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h3. Steps to Reproduce\nDownload the Sample Pdf Viewer Code from 'https://gist.github.com/lbrenman/fa5195aba08d1b5e8fa0'\nReplace the url in line no 66, index.js file with 'http://dev-cms-molpower.trafficmanager.net/ServiceProfileFileHandler.ashx?svc=CMI&file=FirstSchedule.pdf' for pdf.\nOn clicking the URL button . We get an alert 'This document cannot be opened'.\n\nThe same works with Ti SDK 4.0.0.\n\nh3. Actual Result\nPdf / Xls not getting opened\n\nh3. Expected Result\nThe pdf should be opened successfully", "attachment": [ { "id": "59075", "filename": ".log", "author": { "name": "parween.singh15@gmail.com", "key": "parween.singh15@gmail.com", "displayName": "Parween Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-04-26T10:20:50.000+0000", "size": 0, "mimeType": "text/plain" }, { "id": "59076", "filename": "diagnostic5508536153902136859.log", "author": { "name": "parween.singh15@gmail.com", "key": "parween.singh15@gmail.com", "displayName": "Parween Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-04-26T10:22:11.000+0000", "size": 117068, "mimeType": "text/plain" } ], "flagged": false, "summary": "Android: pdf and xls files with response headers (Content-Type →application/octet-stream) not opening with Ti sdk 5.0.0,5.1.1, 5.2.0", "creator": { "name": "parween.singh15@gmail.com", "key": "parween.singh15@gmail.com", "displayName": "Parween Singh", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "parween.singh15@gmail.com", "key": "parween.singh15@gmail.com", "displayName": "Parween Singh", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 678, "state": "closed", "name": "2016 Sprint 14 SDK", "startDate": "2016-07-02T00:25:57.921Z", "endDate": "2016-07-16T00:25:00.000Z", "completeDate": "2016-07-18T03:18:29.729Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "384155", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\nI am able to reproduce this issue. It seems that when build with SDK 5.2.2.GA downloaded pdf file becomes corrupted.\r\n*Setps:*\r\n1. Create a default alloy project.\r\n2. Replace corresponding file code with following.\r\n*index.js :*\r\n{code}\r\nfunction resourcePDF(e) {\r\n\topenResourcePDF();\r\n}\r\n\r\nfunction urlPDF(e) {\r\n\topenURLPDF();\r\n}\r\n\r\nfunction viewPDF(appfilepath) {\r\n\tif (OS_ANDROID) {\r\n\t\ttry {\r\n\t\t\tTi.Android.currentActivity.startActivity(Ti.Android.createIntent({\r\n\t\t\t\taction : Ti.Android.ACTION_VIEW,\r\n\t\t\t\ttype : 'application/pdf',\r\n\t\t\t\tdata : appfilepath\r\n\t\t\t}));\r\n\t\t} catch(e) {\r\n\t\t\tTi.API.info('error trying to launch activity, e = ' + e);\r\n\t\t\talert('No PDF apps installed!');\r\n\t\t}\r\n\t} else {\r\n\t\tdocViewer = Ti.UI.iOS.createDocumentViewer({\r\n\t\t\turl : appfilepath\r\n\t\t});\r\n\t\tdocViewer.show();\r\n\t}\r\n}\r\n\r\nfunction openResourcePDF() {\r\n\tvar appFile;\r\n\r\n\tif (OS_ANDROID) {\r\n\t\t//copy from app directory to SDCard (once)\r\n\t\tvar originalFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'pdf/sample.pdf');\r\n\t\tappFile = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, 'sample.pdf');\r\n\t\tif (appFile.exists() === false) {\r\n\t\t\tappFile.write(originalFile.read());\r\n\t\t}\r\n\t} else {\r\n\t\tappFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'pdf/sample.pdf');\r\n\t}\r\n\tvar appfilepath = appFile.nativePath;\r\n\r\n\tviewPDF(appfilepath);\r\n}\r\n\r\nfunction openURLPDF() {\r\n\tvar appFile;\r\n\r\n\tif (OS_ANDROID) {\r\n\t\tappFile = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, 'map.pdf');\r\n\t} else {\r\n\t\tappFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'map.pdf');\r\n\t}\r\n\tvar appfilepath = appFile.nativePath;\r\n\r\n\t//Check if file has been downloaded yet\r\n\tif (appFile.exists() === false) {\r\n\t\tvar xhr = Ti.Network.createHTTPClient();\r\n\t\txhr.onload = function() {\r\n\t\t\tappFile.write(this.responseData);\r\n\t\t\tviewPDF(appfilepath);\r\n\t\t};\r\n\t\txhr.onerror = function() {\r\n\t\t\talert(\"Cannot retrieve PDF form web site\");\r\n\t\t};\r\n\t\txhr.timeout = 10000;\r\n\t\txhr.open(\"GET\", \"http://dev-cms-molpower.trafficmanager.net/ServiceProfileFileHandler.ashx?svc=CMI&file=FirstSchedule.pdf\");\r\n\t\txhr.send();\r\n\r\n\t} else {\r\n\t\tviewPDF(appfilepath);\r\n\t}\r\n}\r\n\r\n$.index.open();\r\n{code}\r\n*index.tss :*\r\n{code}\r\n\".container\": {\r\n\tbackgroundColor:\"white\"\r\n}\r\n\r\n\"Label\": {\r\n\twidth: Ti.UI.SIZE,\r\n\theight: Ti.UI.SIZE,\r\n\tcolor: \"#000\"\r\n}\r\n\r\n\"#label\": {\r\n\tfont: {\r\n\t\tfontSize: 12\r\n\t}\r\n}\r\n{code}\r\n*index.xml :*\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\t\t