nextcloud / nextcloud/desktop

[Bug]: Desktop client deletes local files if the same version is already synced to server

Open
#8,422 1 comment 0 reactions 1 assignee Claimed by @camilasan View on GitHub
bug
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

When I copy files to my nextcloud directory, that are already present on the server (and have a virtual file link), the client is deleting the local file version after comparing the file with the server. So it may be uploading gigabytes of data and then deleting it, and if I need the files locally they are downloaded again...

https://github.com/user-attachments/assets/11c03fbb-1f8b-43d8-ad64-e8028f1c8d30

### Steps to reproduce

1. Have file `foobar.txt` on nextcloud server, file is not available offline, the file is virtual in windows explorer (Icon == cloud)
2. Copy same version of file `foobar.txt` from another path to nextcloud folder, confirm replace existing file.
3. The client determines file version (by comparing hashes?) and finds that the local file matches with the version already stored on nextcloud server, thus no upload required
4. The client deletes the local file version instead of leaving it alone. This is unexpected.

The behavior seems to be reproducible with any file in any path:

https://github.com/user-attachments/assets/7f2396c8-cc18-4055-806a-2f597525b75a

### Expected behavior

If I copy local files to the nextcloud directory, nextcloud MUST NOT DELETE THIS COPY FROM THE DEVICE, whether they have been uploaded to nextcloud or not.

After copying files to a nextcloud directory, these files should have the status icon Green checkmark on white background
![locally available files](https://github.com/user-attachments/assets/d3f04ba0-11e0-4257-84b5-0d64c988a8ab)
, as if they have been "opened" from the cloud.

I expect the local file to be removed ONLY when the user executes "Release local storage" (I don't know the exact english version, mine is German).

![Release local storage](https://github.com/user-attachments/assets/2be321c0-3367-42e1-b061-f078b938bb73)
Only this action should remove the local copy.

### Which files are affected by this bug

-

### Operating system

Windows

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

Windows 10, 22H2, 19045.5965

### Package

Official Windows MSI

### Nextcloud Server version

30.0.10

### Nextcloud Desktop Client version

3.16.6

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

Updated from a minor version (ex. 3.4.2 to 3.4.4)

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

Encryption is Disabled

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

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

### Nextcloud Server logs

```shell
Unavailable due to externally hosted nextcloud server.
```

### Additional info

I tried a workaround, but it was not successful. I have set the affected files to "always keep available locally" (White checkmark on green background). e.g. 317 files, 4 GB in my case. Nextcloud starts downloading these files.
Then I copy the files from my locally available path to nextcloud (because I have the files on my phone), to save the time it takes to download.

However, the client is too dumb to notice this and continues downloading even though all the files are already available.

So I closed the client application. Copied the local files AGAIN to the nextcloud folder (which is set to "keep available locally").
Then I restart the client application. Now, the synchonisation state of those files is broken. Nextcloud does not recognize them, file activity states I have deleted (??) those files, they exist in the folder, they are gone from the nextcloud server.

Wow, at this point I just give up...

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.