From d2f2e3305a1d485a3cc67b6bf715fd16b68d1d84 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 8 Jul 2021 11:45:38 +0200 Subject: avoid being stuck trying to create placeholder for existing file id sync db think a file is cirtual (empty placeholder) but file system has a real file (non empty file) once the server has a modified version we can no longer update it state of file on disk takes precedence over sync DB to allow recovery Signed-off-by: Matthieu Gallien --- src/libsync/discovery.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/libsync/discovery.cpp') diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 062ed5251..bd39c6ae8 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -349,6 +349,10 @@ void ProcessDirectoryJob::processFile(PathTuple path, item->_previousSize = dbEntry._fileSize; item->_previousModtime = dbEntry._modtime; + if (dbEntry._modtime == localEntry.modtime && dbEntry._type == ItemTypeVirtualFile && localEntry.type == ItemTypeFile) { + item->_type = ItemTypeFile; + } + // 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 // either in processFileAnalyzeRemoteInfo() or further down here. @@ -710,8 +714,9 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( item->_type = ItemTypeVirtualFile; } - if (dbEntry.isVirtualFile() && !virtualFileDownload) + if (dbEntry.isVirtualFile() && (!localEntry.isValid() || localEntry.isVirtualFile) && !virtualFileDownload) { item->_type = ItemTypeVirtualFile; + } _childModified |= serverModified; -- cgit v1.2.3