[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
Utils
|
@ -107,17 +107,12 @@ static SandboxBroker *kSharedSandboxBroker = nil;
|
||||||
|
|
||||||
NSString *s = [url path];
|
NSString *s = [url path];
|
||||||
|
|
||||||
NSString *lastComponent = [url fragment];
|
NSRange fragmentRange = [s rangeOfString:@"#"
|
||||||
|
|
||||||
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
|
|
||||||
options:NSBackwardsSearch];
|
options:NSBackwardsSearch];
|
||||||
|
|
||||||
|
if(fragmentRange.location != NSNotFound) {
|
||||||
// Chop the fragment.
|
// Chop the fragment.
|
||||||
NSString *newURLString = [s substringToIndex:fragmentRange.location + fragmentRange.length];
|
NSString *newURLString = [s substringToIndex:fragmentRange.location];
|
||||||
|
|
||||||
return [NSURL fileURLWithPath:newURLString];
|
return [NSURL fileURLWithPath:newURLString];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue