diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index 832999d75a3fd..b834c024b035e 100644 --- a/src/libsync/propagateupload.cpp +++ b/src/libsync/propagateupload.cpp @@ -255,6 +255,8 @@ void PropagateUploadFileCommon::setupUnencryptedFile() } void PropagateUploadFileCommon::startUploadFile() { + Q_ASSERT(_item->_type != CSyncEnums::ItemTypeVirtualFile); + if (propagator()->_abortRequested) { return; } diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index b74b05bf3a95c..23c41be9e991b 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -992,9 +992,11 @@ void SyncEngine::restoreOldFiles(SyncFileItemVector &syncItems) syncItem->_instruction = CSYNC_INSTRUCTION_CONFLICT; break; case CSYNC_INSTRUCTION_REMOVE: - qCWarning(lcEngine) << "restoreOldFiles: RESTORING" << syncItem->_file; - syncItem->_instruction = CSYNC_INSTRUCTION_NEW; - syncItem->_direction = SyncFileItem::Up; + if (syncItem->_type != CSyncEnums::ItemTypeVirtualFile && syncItem->_type != CSyncEnums::ItemTypeVirtualFileDownload) { + qCWarning(lcEngine) << "restoreOldFiles: RESTORING" << syncItem->_file; + syncItem->_instruction = CSYNC_INSTRUCTION_NEW; + syncItem->_direction = SyncFileItem::Up; + } break; case CSYNC_INSTRUCTION_RENAME: case CSYNC_INSTRUCTION_NEW: diff --git a/test/testsynccfapi.cpp b/test/testsynccfapi.cpp index 4b06b6e15cc72..95dd076ffc38f 100644 --- a/test/testsynccfapi.cpp +++ b/test/testsynccfapi.cpp @@ -1218,6 +1218,32 @@ private slots: CFVERIFY_VIRTUAL(fakeFolder, "online/sub/file1"); } } + + void testDataFingerPrint() + { + FakeFolder fakeFolder{ FileInfo{} }; + setupVfs(fakeFolder); + + fakeFolder.remoteModifier().mkdir("a"); + fakeFolder.remoteModifier().mkdir("a/b"); + fakeFolder.remoteModifier().mkdir("a/b/d"); + fakeFolder.remoteModifier().insert("a/b/otherFile.txt"); + + //Server support finger print, but none is set. + fakeFolder.remoteModifier().extraDavProperties = ""; + + fakeFolder.syncEngine().setLocalDiscoveryOptions(OCC::LocalDiscoveryStyle::DatabaseAndFilesystem); + QVERIFY(fakeFolder.syncOnce()); + + fakeFolder.remoteModifier().remove("a/b/otherFile.txt"); + fakeFolder.remoteModifier().remove("a/b/d"); + fakeFolder.remoteModifier().extraDavProperties = "initial_finger_print"; + + fakeFolder.syncEngine().setLocalDiscoveryOptions(OCC::LocalDiscoveryStyle::DatabaseAndFilesystem); + QVERIFY(fakeFolder.syncOnce()); + + QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); + } }; QTEST_GUILESS_MAIN(TestSyncCfApi) diff --git a/test/testsyncvirtualfiles.cpp b/test/testsyncvirtualfiles.cpp index 1dd091dbda85b..a4ce8c8c66ce6 100644 --- a/test/testsyncvirtualfiles.cpp +++ b/test/testsyncvirtualfiles.cpp @@ -1880,6 +1880,32 @@ private slots: conflicts = findCaseClashConflicts(*fakeFolder.currentLocalState().find("a/b")); QCOMPARE(conflicts.size(), shouldHaveCaseClashConflict ? 1 : 0); } + + void testDataFingerPrint() + { + FakeFolder fakeFolder{ FileInfo{} }; + setupVfs(fakeFolder); + + fakeFolder.remoteModifier().mkdir("a"); + fakeFolder.remoteModifier().mkdir("a/b"); + fakeFolder.remoteModifier().mkdir("a/b/d"); + fakeFolder.remoteModifier().insert("a/b/otherFile.txt"); + + //Server support finger print, but none is set. + fakeFolder.remoteModifier().extraDavProperties = ""; + + fakeFolder.syncEngine().setLocalDiscoveryOptions(OCC::LocalDiscoveryStyle::DatabaseAndFilesystem); + QVERIFY(fakeFolder.syncOnce()); + + fakeFolder.remoteModifier().remove("a/b/otherFile.txt"); + fakeFolder.remoteModifier().remove("a/b/d"); + fakeFolder.remoteModifier().extraDavProperties = "initial_finger_print"; + + fakeFolder.syncEngine().setLocalDiscoveryOptions(OCC::LocalDiscoveryStyle::DatabaseAndFilesystem); + QVERIFY(fakeFolder.syncOnce()); + + QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); + } }; QTEST_GUILESS_MAIN(TestSyncVirtualFiles)