Skip to content

Commit

Permalink
Merge pull request #53 from Yazany6b/hotfix/url-with-spaces
Browse files Browse the repository at this point in the history
Fix image url with empty spaces or non ASCII characters
  • Loading branch information
AndreaVitale authored May 17, 2018
2 parents f3dde59 + 5c3bfe6 commit c43f223
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 @@ -119,7 +119,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 c43f223

Please sign in to comment.