From 7061f31887293a8c5ee225c9f6d935fd1c1b2c42 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 7 Nov 2018 10:49:33 +0100 Subject: [PATCH] Discovery: Fix downloading files when database is used for local discovery This also fix the currently failling LockedFilesTest --- src/libsync/discovery.cpp | 6 ++---- test/testlocaldiscovery.cpp | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 494d76c48..e6aab5b09 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -281,6 +281,8 @@ void ProcessDirectoryJob::processFile(PathTuple path, auto item = SyncFileItem::fromSyncJournalFileRecord(dbEntry); item->_file = path._target; item->_originalFile = path._original; + item->_previousSize = dbEntry._fileSize; + item->_previousModtime = dbEntry._modtime; // The item shall only have this type if the db request for the virtual download // was successful (like: no conflicting remote remove etc). This decision is done @@ -331,8 +333,6 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo( item->_remotePerm = serverEntry.remotePerm; item->_type = serverEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile; item->_etag = serverEntry.etag; - item->_previousSize = localEntry.size; - item->_previousModtime = localEntry.modtime; item->_directDownloadUrl = serverEntry.directDownloadUrl; item->_directDownloadCookies = serverEntry.directDownloadCookies; @@ -676,8 +676,6 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( item->_checksumHeader.clear(); item->_size = localEntry.size; item->_modtime = localEntry.modtime; - item->_previousSize = dbEntry._fileSize; - item->_previousModtime = dbEntry._modtime; _childModified = true; // Checksum comparison at this stage is only enabled for .eml files, diff --git a/test/testlocaldiscovery.cpp b/test/testlocaldiscovery.cpp index 9dd36012f..babc91bd8 100644 --- a/test/testlocaldiscovery.cpp +++ b/test/testlocaldiscovery.cpp @@ -45,8 +45,9 @@ private slots: fakeFolder.localModifier().insert("A/Y/y2"); fakeFolder.localModifier().insert("B/b3"); fakeFolder.remoteModifier().insert("C/c3"); - + fakeFolder.remoteModifier().appendByte("C/c1"); tracker.addTouchedPath("A/X"); + fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::DatabaseAndFilesystem, tracker.localDiscoveryPaths()); tracker.startSyncPartialDiscovery();