nextcloud / nextcloud/android

uploading option "delete file from source folder" deletes files even when upload fails

Open
#16,583 2 comments 0 reactions 1 assignee Claimed by @alperozturk96 View on GitHub
bug
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### ⚠️ Before posting ⚠️

- [x] This is a **bug**, not a question or an enhancement.
- [x] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).

### Steps to reproduce

1. In the android client, in a new folder, click + ("Add to nextcloud")
2. "Upload files"
3. For "Upload option", select "Delete file from source folder"
4. Select all files in a media directory
5. Ssome uploads fail: of 2000 or so files, only around 10-20% have any data, the rest are 0 byte files
6. The client still deletes all files from the source folder despite uploads failing, resulting in data loss.

### Expected behaviour

If any uploads result in 0 byte files, the client should not delete from source folder.

### Actual behaviour

All files are deleted from source folder, regardless of whether a given file was successfully uploaded or not, resulting in data loss.

### Android version

12.0.0

### Device brand and model

Huawei ELE-L29

### Stock or custom OS?

Stock

### Nextcloud android app version

33.0.0

### Nextcloud server version

31.0.8

### Using a reverse proxy?

I don't know

### Android logs

_No response_

### Server error logs

```bash
[no app in context] Error: Expected filesize of 40960000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 34029568 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.
PUT /remote.php/dav/uploads/nina/d6b6d54533bc17efc7e85d560cbe068c/000002
from 177.63.108.32 by nina at Feb 23, 2026, 5:12:48 PM
[no app in context] Error: Expected filesize of 40960000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 23994368 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.
PUT /remote.php/dav/uploads/nina/89b5e1ea4403203208a9f6e369982d4d/000001
from 177.63.108.32 by nina at Feb 23, 2026, 4:20:32 PM
[no app in context] Error: Expected filesize of 40960000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 7307264 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.
PUT /remote.php/dav/uploads/nina/86352686bfb366cf5c8c9cc187012e8b/000001
from 177.63.108.32 by nina at Feb 23, 2026, 3:23:52 PM
[no app in context] Error: Expected filesize of 40960000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 38682624 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.
PUT /remote.php/dav/uploads/nina/18736d3781f24f6cbed2d88f792417c2/000009
from 177.63.108.32 by nina at Feb 23, 2026, 3:22:42 PM
```

### Additional information

Unfortunately I don't have access to the user's device to provide logs. (I'm admin.)

While 1000s of 0 byte files were created, there were only 4 errors in the logs.

Our nextcloud is on a Yunohost server.

I'm unsure why the 0 byte file uploads occurred, I've never had that issue before. (Would also like to solve it.)

I guess you might want to say that the user shouldn't try to do that (they should use auto-upload), but nonetheless, the app lets them do it.

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.