Skip to content

Commit

Permalink
Merge pull request #7515 from nextcloud/backport/7432/stable-3.14
Browse files Browse the repository at this point in the history
[stable-3.14] Fix crash when setting badge for a path that results in a nil URL (macOS FinderSyncExt)
  • Loading branch information
mgallien authored Nov 19, 2024
2 parents 7f0c0df + 386e8ea commit 0fc7fcc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
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 @@ -15,7 +15,7 @@
#import <Foundation/Foundation.h>

@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

0 comments on commit 0fc7fcc

Please sign in to comment.