Normalize the path pattern instead of throwing an assertion

This commit is contained in:
Blake Watters
2012-10-05 16:29:25 -04:00
parent 635b6257d1
commit 17f9a1af8b
4 changed files with 28 additions and 15 deletions

View File

@@ -125,6 +125,6 @@ NSString *RKPathNormalize(NSString *path)
path = [path stringByReplacingOccurrencesOfString:@"//" withString:@"/"];
NSUInteger length = [path length];
if ([path characterAtIndex:length - 1] == '/') path = [path substringToIndex:length - 1];
if ([path characterAtIndex:0] != '/') path = [@"/" stringByAppendingString:path];
if ([path characterAtIndex:0] != '/') path = [NSString stringWithFormat:@"/%@", path];
return path;
}