vfs: Allow remote renames to propagate as such
authorChristian Kamm <mail@ckamm.de>
Mon, 12 Nov 2018 11:23:22 +0000 (12:23 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:22 +0000 (10:58 +0100)
src/libsync/discovery.cpp

index 8d1854931c579356a99683d80fbff0223714f9af..c059c73932b7a58ec3285f9509f37607ff8b419a 100644 (file)
@@ -460,12 +460,6 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(
         // Now we know there is a sane rename candidate.
         QString originalPath = QString::fromUtf8(base._path);
 
-        // Rename of a virtual file
-        if (base.isVirtualFile() && item->_type == ItemTypeFile) {
-            // Ignore if the base is a virtual files
-            return;
-        }
-
         if (_discoveryData->_renamedItems.contains(originalPath)) {
             qCInfo(lcDisco, "folder already has a rename entry, skipping");
             return;
@@ -480,12 +474,14 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(
             return;
         }
 
-        if (!item->isDirectory()) {
+        if (!base.isDirectory()) {
             csync_file_stat_t buf;
             if (csync_vio_local_stat((_discoveryData->_localDir + originalPath).toUtf8(), &buf)) {
                 qCInfo(lcDisco) << "Local file does not exist anymore." << originalPath;
                 return;
             }
+            // NOTE: This prohibits some VFS renames from being detected since
+            // suffix-file size is different from the db size. That's ok, they'll DELETE+NEW.
             if (buf.modtime != base._modtime || buf.size != base._fileSize || buf.type == ItemTypeDirectory) {
                 qCInfo(lcDisco) << "File has changed locally, not a rename." << originalPath;
                 return;
@@ -497,6 +493,11 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(
             }
         }
 
+        // Renames of virtuals are possible
+        if (base.isVirtualFile()) {
+            item->_type = ItemTypeVirtualFile;
+        }
+
         bool wasDeletedOnServer = _discoveryData->findAndCancelDeletedJob(originalPath).first;
 
         auto postProcessRename = [this, item, base, originalPath](PathTuple &path) {