Commit dfad2694 authored by Carola Nitz's avatar Carola Nitz

MLMediaLibraryKit: fix duplication of Files

When Files with a cyrillic characters were used, the relativepath and path component
would hold differently compositions(codepoints) of that character, which led to a mismatch when we
tried to query for the files with this path. Using the decomposed canonical equivalent will return a normalized String
after Unicode Normalization Form D which ensures that we have an identical String no matter the composition.
parent f4598267
......@@ -824,6 +824,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
// on iPhone we only save relative paths ins the DB
relativePath = [self pathRelativeToDocumentsFolderFromAbsolutPath:path];
#endif
relativePath = [relativePath decomposedStringWithCanonicalMapping];
[urlToObject setObject:path forKey:relativePath];
[fetchPredicates addObject:[NSPredicate predicateWithFormat:@"path == %@", relativePath]];
}
......@@ -844,6 +845,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
// Remove objects that are already in db.
for (MLFile *dbResult in dbResults) {
NSString *path = dbResult.path;
path = [path decomposedStringWithCanonicalMapping];
[filePathsToAdd removeObject:[urlToObject objectForKey:path]];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment