Skip to content

Introduce Partial Delete: Improved remoteDelete propagation#9663

Closed
vacy wants to merge 2 commits intonextcloud:masterfrom
vacy:master
Closed

Introduce Partial Delete: Improved remoteDelete propagation#9663
vacy wants to merge 2 commits intonextcloud:masterfrom
vacy:master

Conversation

@vacy
Copy link
Copy Markdown

@vacy vacy commented Mar 23, 2026

Summary

If a user deletes a folder, one would expect to delete only data that the user could've seen.
In case the deleted folder contains data, that was deselected for sync - thus user didnt see that - the desktop client would also delete that unseen data on the server.

I already had some discussion about a while ago in: #6948 and https://help.nextcloud.com/t/desktop-client-triggered-deletions-are-deleting-not-synced-data/199356

Comparison to competitors

Also compared this behavior to OneDrive and Dropbox. Both keep data on the server, because they assume the user has not seen it, thus does not want to delete that portion.

When would you face this problem?

  • You decided willingly to sync only part of the folder structure. You forget about it and delete the parent.

  • Syncengine decided automatically that a folder would be added to blacklist, you most likely do not know about that.
    Yes the client notifies about it. But does it always? Notifications are also prone to alert fatigue.

  • I would also expect this problem, but that is not verified:
    -> When data is incoming from your own account or a received share and the client is still downloading the data
    -> You delete the folder and it deletes everything on the server, even data you didnt see yet and even data in a received share.

Changes

Implements a safety mechanism to prevent dataloss when deleting folders that contain selective sync exclusions.

When a folder containing unsynced descendants is deleted:

  • Instead of deleting the whole folder on the server, only the synced content is deleted - i.e. content the user was able to see.
  • The folder itself and any unsynced content remains on the server.
  • This preserves data that would otherwise be lost.

Changes:

  • common/syncjournaldb.cpp:

    • added hasSelectiveSyncDescendants() to check if a path has unsynced descendants in the selective sync blacklist.
    • added getSyncedDescendants() to get all synced items within a folder path.
  • libsync/propagateremotedelete.cpp: modified start() to detect when a folder deletion would affect unsynced content. Implements partial deletion
    mode that deletes synced items individually while preserving the
    folder and unsynced content.

  • libsync/owncloudpropagator.cpp: added selectiveSyncList management

Fixes #6948

Implements a safety mechanism to prevent dataloss when deleting folders
that contain selective sync exclusions.

When a folder containing unsynced descendants is deleted:

- Instead of deleting the whole folder on the server, only the synced
   content is deleted - i.e. content the user was able to see.
- The folder itself and any unsynced content remains on the server.
- This preserves data that would otherwise be lost.

Changes:
- common/syncjournaldb.cpp:
    - added hasSelectiveSyncDescendants() to check if a path
        has unsynced descendants in the selective sync blacklist.
    - added getSyncedDescendants() to get all synced items
        within a folder path.

- libsync/propagateremotedelete.cpp: modified start() to detect when a folder
  deletion would affect unsynced content. Implements partial deletion
  mode that deletes   synced items individually while preserving the
  folder and unsynced content.

- libsync/owncloudpropagator.cpp: added selectiveSyncList management

Fixes nextcloud#6948

Signed-off-by: Jan-Florian Hilgenberg <florianhilgenberg@gmail.com>
Copy link
Copy Markdown
Collaborator

@mgallien mgallien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vacy can you please add automated tests covering the changes you have done ?
I am very unconvinced about the behavior change as it would be very confusing that when you delete a folder, it ends up not being deleted
so if I get it correctly, you would have:

parent [*]
parent/child1 [*]
parent/child2 [ ]

if you delete parent, you would like to preserve the unsynced folder parent/child2
do you also avoid deleting parent ?

@mgallien
Copy link
Copy Markdown
Collaborator

mgallien commented Apr 3, 2026

from what I understand, the plan is that on client side, if you use selective synchronization or folders on-demand (possible on Windows and macOS with virtual files), deleting parent folder may result in this folder not being deleted

we want to move away from selective sync for the more flexible option of using virtual files on all platforms (including only syncing the content of folders you have really accessed)
in that case, it is very much possible that you would not have synced all child folders when deleting a parent. In that case, not deleting a folder after an user action is to delete it may run contrary to their expectations

I did some testing with other products and they apparently opt in a warning popup that local deletions is also going to be a remote deletion with an option disable the warning
I would suggest having a look at such warnings (with an easy way to disable them) rather than going with the current PR
we also discussed in the team what would be the result for an user
you have a server trashbin
with current state, parent folder will appear as a single item in trashbin with an easy single click action to restore it
with your PR, you would see some of the child folders inside parent while you were trying to delete parent
you would confuse users

we would like to encourage you to keep contributing to the files desktop client and would be happy to review other PRs from you
I would rather close this one as we see more issues than advantages

@mgallien mgallien closed this Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: client triggered deletions - partly-synced nested directories delete also directories on the server that are not configured to sync

2 participants