Skip to content

Commit

Permalink
ensure proper VFS metadata when restoring folders
Browse files Browse the repository at this point in the history
when remote move is forbidden, desktop client will move back the folder
to its original name

in such cases, we were forgetting to set VFS metadata in their proper
state (i.e. placeholder in sync)

so ensure that when a remote move fails, we still touch VFS metadata
when appropriate and handle errors

Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed May 6, 2024
1 parent 0d7ab96 commit 8692a8c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libsync/propagateremotemove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,19 @@ void PropagateRemoteMove::slotMoveJobFinished()
qCWarning(lcPropagateRemoteMove)
<< "Could not MOVE file" << filePathOriginal << " to" << filePath
<< " with error:" << _job->errorString() << " and successfully restored it.";

auto restoredItem = *_item;
restoredItem._renameTarget = _item->_originalFile;
const auto result = propagator()->updateMetadata(restoredItem);
if (!result) {
done(SyncFileItem::FatalError, tr("Error updating metadata: %1").arg(result.error()), ErrorCategory::GenericError);
return;
} else if (*result == Vfs::ConvertToPlaceholderResult::Locked) {
done(SyncFileItem::SoftError, tr("The file %1 is currently in use").arg(restoredItem._file), ErrorCategory::GenericError);
return;
}
}

done(status, _job->errorString(), ErrorCategory::GenericError);
return;
}
Expand Down

0 comments on commit 8692a8c

Please sign in to comment.