Skip to content

Commit cc46c5a

Browse files
committed
[Sandbox Configuration] Do more checks on test
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>
1 parent 3d8f470 commit cc46c5a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Preferences/Preferences/SandboxPathBehaviorController.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,14 @@ - (void)removeStaleEntries {
119119
- (BOOL)matchesPath:(NSURL *)url {
120120
id sandboxBrokerClass = NSClassFromString(@"SandboxBroker");
121121
for(NSDictionary *entry in [self arrangedObjects]) {
122-
NSURL *testPath = [NSURL fileURLWithPath:[entry objectForKey:@"path"]];
123-
if([sandboxBrokerClass isPath:url aSubdirectoryOf:testPath])
124-
return YES;
122+
if([[entry objectForKey:@"valid"] isEqualToString:NSLocalizedPrefString(@"ValidYes")]) {
123+
NSString *path = [entry objectForKey:@"path"];
124+
if(path && [path length]) {
125+
NSURL *testPath = [NSURL fileURLWithPath:[entry objectForKey:@"path"]];
126+
if([sandboxBrokerClass isPath:url aSubdirectoryOf:testPath])
127+
return YES;
128+
}
129+
}
125130
}
126131
return NO;
127132
}

0 commit comments

Comments
 (0)