Skip to content

Commit e798444

Browse files
committed
Safer transformation of NSURLFromNSString
e.g. this will handle white spaces in string (convert to %20) instead of returning a nil object.
1 parent e7386f0 commit e798444

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

JSONModel/JSONModelTransformations/JSONValueTransformer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ -(NSString*)NSStringFromNSDecimalNumber:(NSDecimalNumber*)number
202202
#pragma mark - string <-> url
203203
-(NSURL*)NSURLFromNSString:(NSString*)string
204204
{
205-
return [NSURL URLWithString:string];
205+
return [NSURL URLWithString:[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
206206
}
207207

208208
-(NSString*)JSONObjectFromNSURL:(NSURL*)url

0 commit comments

Comments
 (0)