Undo regression caused by 727e73d
authorDaniel Molkentin <danimo@owncloud.com>
Fri, 27 May 2016 14:03:59 +0000 (16:03 +0200)
committerDaniel Molkentin <danimo@owncloud.com>
Fri, 27 May 2016 14:03:59 +0000 (16:03 +0200)
normalization to NFC is still required. Mac OS API will not take
care of that by default.

Resolves #4884

src/libsync/syncfilestatustracker.cpp

index c083bd4c6f0ea28af77ac57dda22cd4552d4b4d0..d63b79df89c5a391c6f832ee58ac77a338d3f545 100644 (file)
@@ -94,9 +94,11 @@ SyncFileItem SyncFileStatusTracker::rootSyncFileItem()
 
 SyncFileStatus SyncFileStatusTracker::fileStatus(const QString& relativePath)
 {
-    Q_ASSERT(!relativePath.endsWith(QLatin1Char('/')));
+    // normalization is required for OS X to match file names properly
+    QString normalizedRelativePath = relativePath.normalized(QString::NormalizationForm_C);
+    Q_ASSERT(!normalizedRelativePath.endsWith(QLatin1Char('/')));
 
-    if (relativePath.isEmpty()) {
+    if (normalizedRelativePath.isEmpty()) {
         // This is the root sync folder, it doesn't have an entry in the database and won't be walked by csync, so create one manually.
         return syncFileItemStatus(rootSyncFileItem());
     }
@@ -107,22 +109,22 @@ SyncFileStatus SyncFileStatusTracker::fileStatus(const QString& relativePath)
     // update the exclude list at runtime and doing it statically here removes
     // our ability to notify changes through the fileStatusChanged signal,
     // it's an acceptable compromize to treat all exclude types the same.
-    if( _syncEngine->excludedFiles().isExcluded(_syncEngine->localPath() + relativePath,
+    if( _syncEngine->excludedFiles().isExcluded(_syncEngine->localPath() + normalizedRelativePath,
                                                 _syncEngine->localPath(),
                                                 _syncEngine->ignoreHiddenFiles()) ) {
         return SyncFileStatus(SyncFileStatus::StatusWarning);
     }
 
-    if ( _dirtyPaths.contains(relativePath) )
+    if ( _dirtyPaths.contains(normalizedRelativePath) )
         return SyncFileStatus::StatusSync;
 
-    SyncFileItem* item = _syncEngine->findSyncItem(relativePath);
+    SyncFileItem* item = _syncEngine->findSyncItem(normalizedRelativePath);
     if (item) {
         return syncFileItemStatus(*item);
     }
 
     // If we're not currently syncing that file, look it up in the database to know if it's shared
-    SyncJournalFileRecord rec = _syncEngine->journal()->getFileRecord(relativePath);
+    SyncJournalFileRecord rec = _syncEngine->journal()->getFileRecord(normalizedRelativePath);
     if (rec.isValid()) {
         return syncFileItemStatus(rec.toSyncFileItem());
     }