diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index dc56ec602b85..a0cb64cbb7d9 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -983,19 +983,21 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( bool serverModified = item->_instruction == CSYNC_INSTRUCTION_NEW || item->_instruction == CSYNC_INSTRUCTION_SYNC || item->_instruction == CSYNC_INSTRUCTION_RENAME || item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE; + const auto isTypeChange = item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE; + qCDebug(lcDisco) << "File" << item->_file << "- servermodified:" << serverModified << "noServerEntry:" << noServerEntry; // Decay server modifications to UPDATE_METADATA if the local virtual exists bool hasLocalVirtual = localEntry.isVirtualFile || (_queryLocal == ParentNotChanged && dbEntry.isVirtualFile()); bool virtualFileDownload = item->_type == ItemTypeVirtualFileDownload; - if (serverModified && !virtualFileDownload && hasLocalVirtual) { + if (serverModified && !isTypeChange && !virtualFileDownload && hasLocalVirtual) { item->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA; serverModified = false; item->_type = ItemTypeVirtualFile; } - if (dbEntry.isVirtualFile() && (!localEntry.isValid() || localEntry.isVirtualFile) && !virtualFileDownload) { + if (dbEntry.isVirtualFile() && (!localEntry.isValid() || localEntry.isVirtualFile) && !virtualFileDownload && !isTypeChange) { item->_type = ItemTypeVirtualFile; }