From 53247eb0a1bbead66603837c3c71ec38e1244a62 Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Mon, 6 May 2013 21:30:09 +0000 Subject: Fix bug in GTMURLBuilder that doesn't handle url path with escaped characters. E.g. http://www.google.com/path%3AA/path%3AB would become http://www.google.com/path%3AA/path%3AB/path:A/path:B DELTA=20 (14 added, 3 deleted, 3 changed) --- Foundation/GTMURLBuilder.m | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Foundation/GTMURLBuilder.m') diff --git a/Foundation/GTMURLBuilder.m b/Foundation/GTMURLBuilder.m index 0956755..52ee12a 100644 --- a/Foundation/GTMURLBuilder.m +++ b/Foundation/GTMURLBuilder.m @@ -53,15 +53,12 @@ // NSURL does not work with ports. baseURLString_ = [URL absoluteString]; - if ([URL path]) { + if ([URL query]) { NSRange pathRange = - [baseURLString_ rangeOfString:[URL path] options:NSBackwardsSearch]; + [baseURLString_ rangeOfString:[URL query] options:NSBackwardsSearch]; if (pathRange.location != NSNotFound) { - baseURLString_ = [baseURLString_ substringToIndex:pathRange.location]; + baseURLString_ = [baseURLString_ substringToIndex:pathRange.location-1]; } - - baseURLString_ = - [NSString stringWithFormat:@"%@%@", baseURLString_, [URL path]]; } [baseURLString_ retain]; params_ = [[NSDictionary gtm_dictionaryWithHttpArgumentsString:[URL query]] -- cgit v1.2.3