Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when setting badge for a path that results in a nil URL (macOS FinderSyncExt) #7432

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,14 @@ - (void)subMenuActionClicked:(id)sender {

#pragma mark - SyncClientProxyDelegate implementation

- (void)setResultForPath:(NSString*)path result:(NSString*)result
- (void)setResult:(NSString *)result forPath:(NSString*)path
{
NSString *normalizedPath = [path decomposedStringWithCanonicalMapping];
[[FIFinderSyncController defaultController] setBadgeIdentifier:result forURL:[NSURL fileURLWithPath:normalizedPath]];
NSString *const normalizedPath = path.decomposedStringWithCanonicalMapping;
NSURL *const urlForPath = [NSURL fileURLWithPath:normalizedPath];
if (urlForPath == nil) {
return;
}
[FIFinderSyncController.defaultController setBadgeIdentifier:result forURL:urlForPath];
}

- (void)reFetchFileNameCacheForPath:(NSString*)path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ -(void)process:(NSString*)line

dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Setting result %@ for path %@", result, path);
[self.delegate setResultForPath:path result:result];
[self.delegate setResult:result forPath:path];
});
} else if([command isEqualToString:@"UPDATE_VIEW"]) {
NSString *path = [split objectAtIndex:1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
* for more details.
*/

#import <Foundation/Foundation.h>

Check failure on line 15 in shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/SyncClient.h

View workflow job for this annotation

GitHub Actions / build

shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/SyncClient.h:15:9 [clang-diagnostic-error]

'Foundation/Foundation.h' file not found

@protocol SyncClientDelegate <NSObject>
- (void)setResultForPath:(NSString *)path result:(NSString *)result;
- (void)setResult:(NSString *)result forPath:(NSString *)path;
- (void)reFetchFileNameCacheForPath:(NSString *)path;
- (void)registerPath:(NSString *)path;
- (void)unregisterPath:(NSString *)path;
Expand Down
Loading