nextcloud / nextcloud/desktop

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

Open
#6,948 5 comments 0 reactions 0 assignees View on GitHub
1. to develop bug feature: :arrows_counterclockwise: sync engine
Dominant language
C++
Stars
3.9k
Forks
1k
Avg merge
1d 21h
Merged PRs (30d)
127

Description

### ⚠️ Before submitting, please verify the following: ⚠️

- [X] This is a **bug**, not a question or a configuration issue.
- [X] This issue is **not** already reported on Github (I've searched it).
- [X] Nextcloud Server and Desktop Client are **up to date**. See [Server Maintenance and Release Schedule](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) and [Desktop Releases](https://nextcloud.com/install/#install-clients) for supported versions.
- [X] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/)

### Bug description

I sometimes had a suspision that nextcloud sync feels a little flaky but i way never able to put my finger on it until now.
lets assume we have the folder structure below.

It looks like nextcloud desktop client is removing hidden not synced files and directories on the server that the client has not seen.

### Steps to reproduce

# prepare structure
#### Entries with
```
* are selected to be synced
x is synced because parent folder selected
- is not configured to sync AND not seen by the user
```

`bash: mkdir -p dir-something/dir-foo/dir-subfoo dir-something/dir-bar/dir-subbar`

```
dir-something/
-- dir-bar
-- file-bar
-- dir-subbar
** dir-foo
x file-foo
-- dir-subfoo
```
![folder-config](https://github.com/user-attachments/assets/0acff656-fdf3-4a41-a52a-567795ea34bd)

# sync
So the client goes and syncs as configured in the structure above

# two examples
### 1st way: delete "dir-something"
because you cleaned up stuff and just want to remove dir-something... easy right?

but it also deletes the not synced directories on the server
```
|-- dir-bar
-- file-bar
-- dir-subbar
-- dir-subfoo
```

> dir-something/
> ~~-- dir-bar~~
> -- file-bar
> -- dir-subbar
> ** dir-foo
> x file-foo
> -- dir-subfoo

While you only expected to remove:
```
dir-something/
`** dir-foo
`x file-foo
```

### 2nd way: delete "dir-foo"
because you cleaned up stuff and just wanted to remove dir-foo... easy right?

but it also deletes the not synced directories on the server
```
-- dir-subfoo
```

While you only expected to remove:
```
** dir-foo
x file-foo
```

### Expected behavior

I would expect the desktop client to only delete files and folders that a seen by the user.
In my opinion it needs a workaround to have the nextcloud client handle "unknown non-empty directories" to remove them from the sync config of the client.

But the data needs to stay on the server. does it?

### Which files are affected by this bug

procedure provided

### Operating system

Linux

### Which version of the operating system you are running.

fedora

### Package

Distro package manager

### Nextcloud Server version

28.0.8

### Nextcloud Desktop Client version

3.13.2

### Is this bug present after an update or on a fresh install?

Fresh desktop client install

### Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

### Are you using an external user-backend?

- [ ] Default internal user-backend
- [X] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.