From 0bf705bbe91794c143104c0d4f6e1fa466f45c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Kunz?= Date: Fri, 6 Dec 2024 16:16:27 +0100 Subject: [PATCH] KDESKTOP-1355 - explore folder only if it was not yet in snapshot --- .../remotefilesystemobserverworker.cpp | 38 +++---------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/src/libsyncengine/update_detection/file_system_observer/remotefilesystemobserverworker.cpp b/src/libsyncengine/update_detection/file_system_observer/remotefilesystemobserverworker.cpp index d9390ea4a..df48fdbb1 100644 --- a/src/libsyncengine/update_detection/file_system_observer/remotefilesystemobserverworker.cpp +++ b/src/libsyncengine/update_detection/file_system_observer/remotefilesystemobserverworker.cpp @@ -623,11 +623,15 @@ ExitCode RemoteFileSystemObserverWorker::processAction(ActionInfo &actionInfo, s case ActionCode::actionCodeMoveIn: case ActionCode::actionCodeRestore: case ActionCode::actionCodeCreate: + case ActionCode::actionCodeRename: { + const bool exploreDir = actionInfo.snapshotItem.type() == NodeType::Directory && + actionInfo.actionCode != ActionCode::actionCodeCreate && + !_snapshot->exists(actionInfo.snapshotItem.id()); + _syncPal->removeItemFromTmpBlacklist(actionInfo.snapshotItem.id(), ReplicaSide::Remote); _snapshot->updateItem(actionInfo.snapshotItem); - if (actionInfo.snapshotItem.type() == NodeType::Directory && actionInfo.actionCode != ActionCode::actionCodeCreate) { + if (exploreDir) { // Retrieve all children const ExitCode exitCode = exploreDirectory(actionInfo.snapshotItem.id()); - switch (exitCode) { case ExitCode::NetworkError: if (exitCause() == ExitCause::NetworkTimeout) { @@ -650,37 +654,7 @@ ExitCode RemoteFileSystemObserverWorker::processAction(ActionInfo &actionInfo, s movedItems.insert(actionInfo.snapshotItem.id()); } break; - - // Item renamed - case ActionCode::actionCodeRename: { - _syncPal->removeItemFromTmpBlacklist(actionInfo.snapshotItem.id(), ReplicaSide::Remote); - const bool exploreDir = - actionInfo.snapshotItem.type() == NodeType::Directory && !_snapshot->exists(actionInfo.snapshotItem.id()); - _snapshot->updateItem(actionInfo.snapshotItem); - if (exploreDir) { - // Retrieve all children - const ExitCode exitCode = exploreDirectory(actionInfo.snapshotItem.id()); - - switch (exitCode) { - case ExitCode::NetworkError: - if (exitCause() == ExitCause::NetworkTimeout) { - _syncPal->addError(Error(errId(), exitCode, exitCause())); - } - break; - case ExitCode::LogicError: - if (exitCause() == ExitCause::FullListParsingError) { - _syncPal->addError(Error(_syncPal->syncDbId(), name(), exitCode, exitCause())); - } - break; - default: - break; - } - - if (exitCode != ExitCode::Ok) return exitCode; - } - break; } - // Item edited case ActionCode::actionCodeEdit: _snapshot->updateItem(actionInfo.snapshotItem);