nextcloud / nextcloud/android

Corrupted image creates photos that are cut-off or half gray

Open
#14,545 3 comments 0 reactions 1 assignee Claimed by @tobiasKaminsky View on GitHub
bug feature: transfers stable-3.30
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

This bug is similar to #1350 but that issue has been closed. This may be another problem.

For some time I've noticed that my auto-uploaded pictures are sometimes cut-off or half gray. At first it was just every so often, but now it seems like it's happening every few days. I auto-upload my DCIM folder as a backup.

Here are three examples in the last week. Most of the photos upload fine. The original photos look normal on my phone.

![Image](https://github.com/user-attachments/assets/a1c1cd92-6b0d-4c99-a0d2-fa9ea584904a)
![Image](https://github.com/user-attachments/assets/fd783be5-6d2d-4d72-87c3-334483ce7a8c)
![Image](https://github.com/user-attachments/assets/f0baf944-7435-4eaf-8f4d-895bac2e6e43)

### Expected behaviour

Upload to complete without corrupting images.

### Actual behaviour

Images appear to be corrupted.

### Android version

14.0.0

### Device brand and model

OnePlus 11 5G

### Stock or custom OS?

Stock

### Nextcloud android app version

3.30.8

### Nextcloud server version

Nextcloud Hub 9 (30.0.5)

### Using a reverse proxy?

I don't know

### Android logs

[logcatOutput.txt](https://github.com/user-attachments/files/18774329/logcatOutput.txt)

### Server error logs

```bash
{"reqId":"ZUfYC8WnXMHxmbiEETfB","level":1,"time":"2025-02-09T19:03:20-06:00","remoteAddr":"***REDACTED***","user":"--","app":"core","method":"GET","url":"/","message":"Trusted domain error. \"***REDACTED***\" tried to access using \"***REDACTED***\" as host.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0 Safari/537.36","version":"30.0.5.1","data":{"app":"core"}}
{"reqId":"XvKQYxOkVQ2THcVyjW9x","level":3,"time":"2025-02-10T17:12:40-06:00","remoteAddr":"***REDACTED***","user":"***REDACTED***","app":"no app in context","method":"PUT","url":"/remote.php/dav/files/***REDACTED***/Data/Pictures/PhoneBackup/DCIM/Camera/IMG20250210171217.jpg","message":"Expected filesize of 3433648 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 1933312 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.30.8","version":"30.0.5.1","exception":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 3433648 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 1933312 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":110,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Server.php","line":43,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":371,"function":"start","class":"OCA\\DAV\\Connector\\Sabre\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":19,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":146,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":259,"message":"Expected filesize of 3433648 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 1933312 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","exception":{},"CustomMessage":"Expected filesize of 3433648 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 1933312 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side."}}
```

### Additional information

In the server logs, look for "IMG20250210171217.jpg" which is the picture of the shoe. Note that the uploaded image has been resized for visibility purposes.

Log lines to note:
- Android logs: `Unable to decode stream: java.io.FileNotFoundException`
- Android logs: `java.lang.NullPointerException`
- Server logs: `Expected filesize of 3433648 bytes but read`

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.