Skip to content

Commit

Permalink
Fix Index OOB after interrupted DB commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Topheee committed Mar 27, 2024
1 parent 8639971 commit a4b403f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions MatrixSDK/Data/Store/MXFileStore/MXFileStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -2420,8 +2420,8 @@ - (NSArray*)filesAtPath:(NSString*)path

NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager]
enumeratorAtURL:[NSURL URLWithString:path]
includingPropertiesForKeys:nil
options:0
includingPropertiesForKeys:@[NSURLIsDirectoryKey]
options:NSDirectoryEnumerationProducesRelativePathURLs
errorHandler:^(NSURL *url, NSError *error) {
return YES;
}];
Expand All @@ -2434,11 +2434,7 @@ - (NSArray*)filesAtPath:(NSString*)path
if ([url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil] && ![isDirectory boolValue])
{
// Return a file path relative to 'path'
NSRange range = [url.absoluteString rangeOfString:path];
NSString *relativeFilePath = [url.absoluteString
substringFromIndex:(range.location + range.length)];

[files addObject:relativeFilePath];
[files addObject:[@"/" stringByAppendingString: url.relativeString]];
}
}

Expand Down

0 comments on commit a4b403f

Please sign in to comment.