Skip to content

Commit

Permalink
[Sandbox Configuration] Do more checks on test
Browse files Browse the repository at this point in the history
When testing the path for whether it's in storage, run more tests to
make sure we only care about valid paths, and a path that actually has
a string.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
  • Loading branch information
kode54 committed Jun 21, 2022
1 parent 3d8f470 commit cc46c5a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Preferences/Preferences/SandboxPathBehaviorController.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,14 @@ - (void)removeStaleEntries {
- (BOOL)matchesPath:(NSURL *)url {
id sandboxBrokerClass = NSClassFromString(@"SandboxBroker");
for(NSDictionary *entry in [self arrangedObjects]) {
NSURL *testPath = [NSURL fileURLWithPath:[entry objectForKey:@"path"]];
if([sandboxBrokerClass isPath:url aSubdirectoryOf:testPath])
return YES;
if([[entry objectForKey:@"valid"] isEqualToString:NSLocalizedPrefString(@"ValidYes")]) {
NSString *path = [entry objectForKey:@"path"];
if(path && [path length]) {
NSURL *testPath = [NSURL fileURLWithPath:[entry objectForKey:@"path"]];
if([sandboxBrokerClass isPath:url aSubdirectoryOf:testPath])
return YES;
}
}
}
return NO;
}
Expand Down

0 comments on commit cc46c5a

Please sign in to comment.