[Sandbox] Fix URL fragment removal function
This should be deleting from the #, including the #. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
3c0ccd9d46
commit
4ce180fb2a
|
@ -107,17 +107,12 @@ static SandboxBroker *kSharedSandboxBroker = nil;
|
|||
|
||||
NSString *s = [url path];
|
||||
|
||||
NSString *lastComponent = [url fragment];
|
||||
|
||||
if(lastComponent) {
|
||||
lastComponent = @"#";
|
||||
// Find that last component in the string from the end to make sure
|
||||
// to get the last one
|
||||
NSRange fragmentRange = [s rangeOfString:lastComponent
|
||||
NSRange fragmentRange = [s rangeOfString:@"#"
|
||||
options:NSBackwardsSearch];
|
||||
|
||||
if(fragmentRange.location != NSNotFound) {
|
||||
// Chop the fragment.
|
||||
NSString *newURLString = [s substringToIndex:fragmentRange.location + fragmentRange.length];
|
||||
NSString *newURLString = [s substringToIndex:fragmentRange.location];
|
||||
|
||||
return [NSURL fileURLWithPath:newURLString];
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue