aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMURLBuilder.m
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2013-05-06 21:30:09 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2013-05-06 21:30:09 +0000
commit53247eb0a1bbead66603837c3c71ec38e1244a62 (patch)
tree20e4ed2f59b7fd5899929012deae3d87addfcf8d /Foundation/GTMURLBuilder.m
parenta5d6ae8f62622465a2f5f26b8880029793b2c35d (diff)
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)
Diffstat (limited to 'Foundation/GTMURLBuilder.m')
-rw-r--r--Foundation/GTMURLBuilder.m9
1 files changed, 3 insertions, 6 deletions
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]]