Skip to content

Commit

Permalink
KDESKTOP-1355 - explore folder only if it was not yet in snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementKunz committed Dec 6, 2024
1 parent cf713d2 commit 0bf705b
Showing 1 changed file with 6 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit 0bf705b

Please sign in to comment.