From b24b9744c160f49bc38c9bfec3b01700b849276b Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 29 Jun 2022 12:11:01 -0700 Subject: [PATCH] [Sandbox Config] Correctly test paths for files Signed-off-by: Christopher Snowhill --- Preferences/Preferences/SandboxPathBehaviorController.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Preferences/Preferences/SandboxPathBehaviorController.m b/Preferences/Preferences/SandboxPathBehaviorController.m index f01f92bf2..ea279daef 100644 --- a/Preferences/Preferences/SandboxPathBehaviorController.m +++ b/Preferences/Preferences/SandboxPathBehaviorController.m @@ -48,7 +48,7 @@ ALog(@"Stale bookmark for path: %@, with error: %@", token.path, [err localizedDescription]); continue; } - [self addObject:@{ @"path": token.path, @"valid": (isStale ? NSLocalizedPrefString(@"ValidNo") : NSLocalizedPrefString(@"ValidYes")) }]; + [self addObject:@{ @"path": token.path, @"valid": (isStale ? NSLocalizedPrefString(@"ValidNo") : NSLocalizedPrefString(@"ValidYes")), @"isFolder": @(token.folder) }]; } } } @@ -121,11 +121,14 @@ id sandboxBrokerClass = NSClassFromString(@"SandboxBroker"); for(NSDictionary *entry in [self arrangedObjects]) { if([[entry objectForKey:@"valid"] isEqualToString:NSLocalizedPrefString(@"ValidYes")]) { + BOOL isFolder = [[entry objectForKey:@"isFolder"] boolValue]; NSString *path = [entry objectForKey:@"path"]; if(path && [path length]) { NSURL *testPath = [NSURL fileURLWithPath:[entry objectForKey:@"path"]]; - if([sandboxBrokerClass isPath:url aSubdirectoryOf:testPath]) + if((isFolder && [sandboxBrokerClass isPath:url aSubdirectoryOf:testPath]) || + (!isFolder && [[url path] isEqualToString:path])) { return YES; + } } } }