From 1e03df2aab5616964f26c9920b8302200efe536e Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sun, 26 Jun 2022 02:58:25 -0700 Subject: [PATCH] [Sandbox] Don't try to grant access to container Do not try to grant access to the app's container folder when searching for paths to add. Signed-off-by: Christopher Snowhill --- Preferences/Preferences/PathSuggester.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Preferences/Preferences/PathSuggester.m b/Preferences/Preferences/PathSuggester.m index a55b9e7d4..cf1a88faf 100644 --- a/Preferences/Preferences/PathSuggester.m +++ b/Preferences/Preferences/PathSuggester.m @@ -18,6 +18,11 @@ @property(nonatomic) NSURL *_Nullable url; @end +static NSURL *containerDirectory(void) { + NSString *path = [@"~" stringByExpandingTildeInPath]; + return [NSURL fileURLWithPath:path]; +} + // XXX this is only for comparison, not "escaping the sandbox" static NSURL *pathEscape(NSString *path) { NSString *componentsToRemove = [NSString stringWithFormat:@"Library/Containers/%@/Data/", [[NSBundle mainBundle] bundleIdentifier]]; @@ -92,6 +97,8 @@ static NSURL *defaultMoviesDirectory(void) { NSURL *defaultDownloads = defaultDownloadsDirectory(); NSURL *defaultMovies = defaultMoviesDirectory(); + NSURL *container = containerDirectory(); + id sandboxBrokerClass = NSClassFromString(@"SandboxBroker"); NSMutableArray *items = [[NSMutableArray alloc] init]; @@ -125,6 +132,8 @@ static NSURL *defaultMoviesDirectory(void) { aSubdirectoryOf:defaultDownloads] || [sandboxBrokerClass isPath:url aSubdirectoryOf:defaultMovies] || + [sandboxBrokerClass isPath:url + aSubdirectoryOf:container] || [sandboxPathBehaviorController matchesPath:url]) continue;