From 8462f551a8ac4681c562d5a598060167ca1b92de Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 14 Dec 2023 12:04:38 +0100 Subject: [PATCH 1/2] ensure we do not modify a file that has been just uploaded Signed-off-by: Matthieu Gallien --- src/libsync/syncengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index e67943bb211c..f41dd8aee30f 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -378,7 +378,7 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item) // Ensure it's a placeholder file on disk if (item->_type == ItemTypeFile && _syncOptions._vfs->mode() != Vfs::Off) { - const auto result = _syncOptions._vfs->convertToPlaceholder(filePath, *item); + const auto result = _syncOptions._vfs->convertToPlaceholder(filePath, *item, {}, Vfs::UpdateMetadataType::DatabaseMetadata); if (!result) { item->_status = SyncFileItem::Status::NormalError; item->_instruction = CSYNC_INSTRUCTION_ERROR; @@ -411,7 +411,7 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item) emit itemCompleted(item, ErrorCategory::GenericError); return; } - } else if (modificationHappened || prev._modtime != item->_modtime) { + } else if (prev._modtime != item->_modtime) { if (!FileSystem::setModTime(filePath, item->_modtime)) { item->_instruction = CSYNC_INSTRUCTION_ERROR; item->_errorString = tr("Could not update file metadata: %1").arg(filePath); From 33ede0720383e10d05004e2382f21327077035ae Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 14 Dec 2023 14:39:47 +0100 Subject: [PATCH 2/2] immediately flush logs in automated test of sync engine Signed-off-by: Matthieu Gallien --- test/testsyncengine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index c7408f9f9dc6..9da353c47de4 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -89,7 +89,8 @@ class TestSyncEngine : public QObject private slots: void initTestCase() { - OCC::Logger::instance()->setLogDebug(true); + Logger::instance()->setLogFlush(true); + Logger::instance()->setLogDebug(true); } void testFileDownload() {