{ "id": "170986", "key": "TIMOB-25727", "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": "20060", "description": "", "name": "Release 7.0.2", "archived": false, "released": true, "releaseDate": "2018-02-09" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-02-07T17:24:04.000+0000", "created": "2018-01-26T15:12:28.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "17609", "description": "", "name": "Release 7.0.0", "archived": false, "released": true, "releaseDate": "2017-12-07" } ], "issuelinks": [ { "id": "56304", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "outwardIssue": { "id": "171074", "key": "TIMOB-25766", "fields": { "summary": "Android: Ti.Utils.base64encode for cannot encode (Image) Ti.Blob anymore. Result = null", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-11-15T12:35:36.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Hi,\r\nWe have an oAuth login module to login to our app. During the login process, we will have to decode a token. For this we have used Titanium.Utils.base64decode(token). \r\nThe same code works for TiSDK 6.3.0 and below. \r\nOnce we upgraded the sdk to 7.0.0 the same returns undefined \r\nBelow is the toke thats received while logging in using oAuth. \r\ntoken \r\n{code}\r\n\"eyJzdWIiOiJ0ZXN0IiwiZW1haWwiOiJ0ZXN0IiwiYXVkIjoidGVzdCIsImp0aSI6ImxvTHM4d2o5aWxBQUtWckNxbzhaMFMiLCJpc3MiOiJodHRwczpcL1wvc3NvLmV4YW1wbGUuY29tIiwiaWF0IjoxNTI2MTY3NDc3LCJleHAiOjE1MjYxNjc0NzcsInBpLnRlc3QiOiJMSTRmMW81Q2pqU2tHU2xTanM0bHlPeVlROCJ9\"\r\n{code}\r\nWe have checked this in a simple code with only the below line \r\nTitanium.Utils.base64decode(token) \r\nWorks fine in 6.3.0 and returns undefined in 7.0.0 and above \r\n\r\nThanks \r\n\r\n*EDIT by Hans*: This ticket also fixes an issues where Android would not accept Ti.Filesystem.File parameters in {{base64decode}}. \r\n", "attachment": [ { "id": "64766", "filename": "decodedFile.txt", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-28T21:27:17.000+0000", "size": 21, "mimeType": "text/plain" } ], "flagged": false, "summary": "iOS: base64decode issue observed with SDK 7.0.0 and above", "creator": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "subtasks": [], "reporter": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "environment": "TiSDK 7.0.0.GA \r\niOS 11", "comment": { "comments": [ { "id": "433713", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/9773\r\nPR (7_0_X): https://github.com/appcelerator/titanium_mobile/pull/9779\r\n\r\nTo be tested on both iOS and Android and together with the attached decodedFile.txt:\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Trigger'\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n // Test missing padding, should be a JSON-payload\r\n if (!Ti.Utils.base64decode('eyJzdWIiOiJTc2VsdmFyYWoiLCJlbWFpbCI6IlNzZWx2YXJhaiIsImF1ZCI6ImxhYmFsZXJ0IiwianRpIjoibG9Mczh3ajlpbFNTS1ZyRXFvOFowUyIsImlzcyI6Imh0dHBzOlwvXC9zc28uY2VsZ2VuZS5jb20iLCJpYXQiOjE1MTYxNzY0OTcsImV4cCI6MTUxNjE3Njc5NywicGkuc3JpIjoiTEk0ZjFvNUNqam81ejhQdVJOcWNreU95WVE4In0')) {\r\n alert('ERROR (1)!');\r\n }\r\n\r\n // Test padding\r\n if (Ti.Utils.base64decode('Zg').text !== 'f') {\r\n alert('ERROR (2)!');\r\n }\r\n if (Ti.Utils.base64decode('Zm8').text !== 'fo') {\r\n alert('ERROR (3)!');\r\n }\r\n if (Ti.Utils.base64decode('Zm9v').text != 'foo') {\r\n alert('ERROR (4)');\r\n }\r\n if (Ti.Utils.base64decode('Zm9vYg').text !== 'foob') {\r\n alert('ERROR (5)!');\r\n }\r\n if (Ti.Utils.base64decode('Zm9vYmE').text !== 'fooba') {\r\n alert('ERROR (6)!');\r\n }\r\n if (Ti.Utils.base64decode('Zm9vYmFy').text !== 'foobar') {\r\n alert('ERROR (7)!');\r\n }\r\n\r\n // Test long and short strings (from earlier tickets)\r\n var shortString = 'ABCDEFGHIJ1234567890ABCDEFGHIJ12|psndemo2|abcd:1',\r\n longString = 'ABCDEFGHIJ1234567890ABCDEFGHIJ12|psndemo2|abcd:12345678901234567890',\r\n tiBase64ShortResult = Ti.Utils.base64encode(shortString),\r\n tiBase64LongResult = Ti.Utils.base64encode(longString);\r\n\r\n if (tiBase64ShortResult.getText() !== 'QUJDREVGR0hJSjEyMzQ1Njc4OTBBQkNERUZHSElKMTJ8cHNuZGVtbzJ8YWJjZDox') {\r\n alert('ERROR 8!');\r\n }\r\n \r\n Ti.API.info(tiBase64ShortResult);\r\n Ti.API.info(tiBase64LongResult);\r\n \r\n if (tiBase64LongResult.getText() !== 'QUJDREVGR0hJSjEyMzQ1Njc4OTBBQkNERUZHSElKMTJ8cHNuZGVtbzJ8YWJjZDoxMjM0NTY3ODkwMTIzNDU2Nzg5MA==') {\r\n alert('ERROR 9!');\r\n }\r\n\r\n // Test Ti.File types\r\n var f = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'decodedFile.txt'),\r\n blob = Ti.Utils.base64encode(f),\r\n string;\r\n\r\n if(blob.text !== 'SSBhbSBub3QgZW5jb2RlZCB5ZXQu') {\r\n alert('ERROR 10!');\r\n }\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-26T15:22:05.000+0000", "updated": "2018-01-28T21:39:27.000+0000" }, { "id": "434176", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "FR Passed. Base64 encoding and decoding is working as expected. Tested using the provided sample as well as the Utilities suite.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-02-07T17:24:04.000+0000", "updated": "2018-02-07T17:24:04.000+0000" }, { "id": "434187", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified changes included in SDK builds 7.0.2.v20180207091331 & 7.1.0.v20180205203710", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-02-07T18:42:05.000+0000", "updated": "2018-02-07T18:42:05.000+0000" }, { "id": "443640", "author": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "body": "Still happening in TiSDK 7.4.1 and iOS 12.\r\n\r\nI have an encrypted file transformed in a blob that it's sent to the server. In order to do so we encode it in base 64. \r\nBasically once it's encoded, can't be decoded.\r\nFollowing the encoded string:\r\n\r\n{code}\r\nAwEG0wGDMVCiiQbTAYMxUKKJqVNZVmMvhw+nixOA/Tr9jV8hSko8LO5/x1Z3Y5CY5QkhnnxjGmaaBpaM9L2cqOu4TrSPLGRkaEP5lB6M3+pErqlFMK4SqHkIQ3eLTA8+v6wBy3z3JEsiEccYngDhHunLNabr6nZAURuC4O86wa5axemndkrnBdVvNKhXAtcSNfD2L97nfFluZDtOuNKKG7UNWNw9VwaTFHPJz6z646hGFuRLhPbMATDjUW3A9MKKXmuHdpBJxPRv/jjFyP2sxmkmZj8XqAhNdQYjpHC/FHYvXohn5Tc6HunE/8nKbOofTuzeexCRhQj1XND2TwnitFolMMTtljZN9OHMIF6QxwHR6KpNmUYeMPk3LO02kISChKatSW1KSoop2hLmIbbGbgQj5X2d7EvramEnlXwCzhtPL/FjgJmArnpKg4FVZTdegt9AmZMLfuvKgqUPuxO1LJYRn73KMayTPQbxdsVjWmF9i+IvgGuv6YwZFM8Q0g+70pD/H+boiLum2ziutfD78uNr2W/q3lXczidm8dIxgF0+N7VFqLRR68HwetuojfZNv/KEDu4a51qQNv2AkfwQDrDyqcqyUQZ/HBQNCpN9N5+pyfg2+7xzb/GG+kwTHr5r9kJNnhjkjscE+H5D9G+F0mJ3aOnIk3abvRMYsVahAr3izrfkU8c8sZDgZ0IvgP1u5fXfRB3sPRqUxR2yN8YpWFrL4bG9QUNFFcy7LzAs5XyqRLRev9VIUgb2TW2ezKJ/PiePutiowePeQfgJXwLh7G4UjrGgc3vgcSC0pIGrn5mF0IMT5uMMDR1KA/eURedSGh23kE5lDI6eB49inq6AaAFfLPtvUwB0wQpShSZ4yHEatG96Xkfr69vLKTqRLprk6/vF9ROO8huByCpebnhJBxK2ETDQuZMP1/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df+k7GV/hhFqz2FiT66F49hPrR71PDk8CSQ6CWd82Nu6Lw6qAj48RO3MbUXw5/nTGkzBsJW0qCkIUV/IWTAJiBdIlmDATY4ks1H6uyGmey85ukN9IsyTl0VXN5Dq2v0+FMrsGUArvfv6we1HEYnk8vEcp8A5ZZBw6if7jmH8eWUXYD176HRyctrxsiebi12DNIBftdCOiZlrN88ASHh/K03hsxOZp5zq8b7JfsfC3RsH7655YQ+YCn5xLKoiM+usjNGHuDVukBSo43WyRzhxPoUKSKsqz146KnCE/mpCXJQcl6dNKbDtXwLf4R9p0bqxnU6c1Mz7YBaS1tMF198Y0DdyRQ64rTUqDFqvwc%3D\r\n{code}\r\nWhen we decode it with any online decoder, i's decoded as expected.\r\nWhen we decode it with Titanium, we get the result to be null.\r\n\r\nThis broke our application and we would need an urgent fix!", "updateAuthor": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-11-15T10:40:06.000+0000", "updated": "2018-11-15T10:40:06.000+0000" }, { "id": "443641", "author": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "body": "we ended up using an external library (https://github.com/ekscrypto/Base64) that actually works.\r\n\r\nThe simple conversion you do with: \r\n{code}\r\n NSData *decodedData = [[[NSData alloc] initWithBase64EncodedString:paddedStr options:0] autorelease];\r\n{code}\r\ndoesn't work with our encrypted nsdata.", "updateAuthor": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-11-15T12:35:36.000+0000", "updated": "2018-11-15T12:35:36.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }