From cc46c5a5eee20bc241d86be55d11e9ffff0f2034 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Tue, 21 Jun 2022 16:16:47 -0700 Subject: [PATCH] [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 --- .../Preferences/SandboxPathBehaviorController.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Preferences/Preferences/SandboxPathBehaviorController.m b/Preferences/Preferences/SandboxPathBehaviorController.m index 3b32710b9..cf0c3a2ee 100644 --- a/Preferences/Preferences/SandboxPathBehaviorController.m +++ b/Preferences/Preferences/SandboxPathBehaviorController.m @@ -119,9 +119,14 @@ - (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; }