Set modificationHappened to also depend on file size change
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 7 Aug 2023 00:24:43 +0000 (08:24 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 7 Aug 2023 08:25:19 +0000 (16:25 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/libsync/syncengine.cpp

index a999c8a0edbf59c9d210a747ca1cefe344686c64..656689a550e6048b61c82983d87025fc7bd066ad 100644 (file)
@@ -357,7 +357,7 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
         // mini-jobs later on, we just update metadata right now.
 
         if (item->_direction == SyncFileItem::Down) {
-            auto modificationHappened = false;
+            auto modificationHappened = false; // Decides whether or not we modify file metadata
             QString filePath = _localPath + item->_file;
 
             // If the 'W' remote permission changed, update the local filesystem
@@ -369,6 +369,8 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
                 modificationHappened = FileSystem::setFileReadOnlyWeak(filePath, isReadOnly);
             }
 
+            modificationHappened |= item->_size != prev._fileSize;
+
             auto rec = item->toSyncJournalFileRecordWithInode(filePath);
             if (rec._checksumHeader.isEmpty())
                 rec._checksumHeader = prev._checksumHeader;