From 45ce877040e78fd82344d261c7250ec9cbd80084 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 523f3506a193..2c85fe5136f0 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -379,7 +379,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; @@ -412,7 +412,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 30829635311ac10a066a220a5c50ac1c8c83dc1e 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 fa3e19f1318b..8ef503956740 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() {