Skip to content

Commit

Permalink
Fix image url with empty spaces or non ASCII characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Yazany6b committed May 16, 2018
1 parent 7ce6b57 commit 5c3bfe6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ios/iphone/Classes/AvImageviewImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ -(void)displayImage:(id)imageObj
[imageView sd_cancelCurrentImageFetch];

if ([imageObj isKindOfClass:[NSString class]]) {
NSURL *imageUrl = [NSURL URLWithString:[TiUtils stringValue:imageObj]];
//fix downloading the image if url contains spaces or none ASCII characters
//source : https://stackoverflow.com/questions/1441106/nsdata-nsurl-url-with-space-having-problem
NSString * srtImageUrl = [TiUtils stringValue:imageObj];
srtImageUrl = [srtImageUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSURL *imageUrl = [NSURL URLWithString:srtImageUrl];

if (loadingIndicator) {
activityIndicator.hidden = NO;
Expand Down

0 comments on commit 5c3bfe6

Please sign in to comment.