[TIMOB-10046] iOS: Handle Invalid image type exception gracefully - application crashes with exception if url of image has 'space(s)' in it.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 2.1.0, Release 3.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | core |
Reporter | Anirudh Nagesh |
Assignee | Unknown |
Created | 2012-07-19T15:32:56.000+0000 |
Updated | 2018-02-28T20:03:43.000+0000 |
Description
Run the below sample code in app.js
var window = Titanium.UI.createWindow({
});
var text_with_space_in_it = 'lfjdhljaksfh a sfa sasf';
var imageview = Ti.UI.createImageView({
image:'http://i.ytimg.com/vi/' + text_with_space_in_it + '/2.jpg',
})
// work around is to replace the spaces with %20 or encode the uri
window.add(imageview);
window.open();
Work Around:
var spaces = new RegExp(' ','g'); var imgurl = url.replace(spaces,'%20');
OR
var encoded = encodeURI('http://abc.com/file name.png');
Log from the customer project is attached.
Attachments
File | Date | Size |
---|---|---|
log.txt | 2012-07-19T15:32:56.000+0000 | 3474 |
Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0