[Sandbox] Fix URL fragment removal function

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

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

View File

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