[Sandbox] Fix URL fragment removal function

This should be deleting from the #, including the #.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-29 19:39:13 -07:00
parent 3c0ccd9d46
commit 4ce180fb2a
1 changed files with 4 additions and 9 deletions

View File

@ -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 {