nextcloud / nextcloud/android

Video File was marked as uploaded, but file size is much smaller / file corrupted

Open
#12,990 2 comments 0 reactions 0 assignees View on GitHub
bug feature: auto upload feature: transfers stable-3.29
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. Setup Video auto upload
2. Make a video around 200+ MB
3. Upload will be triggered on a poor connection (upload speed 1,2 Mbps). ![изображение](https://github.com/nextcloud/android/assets/6813635/0ffe55d9-4be7-4a25-9ac5-f54553a14522)
5. See multiple retries and errors in NC Server logs
6. Finally file marked as uploaded
7. Check file on a server and it has totally different size: 34 MB, vs 200+ MB original file. ![Screenshot_20240507_122856_Firefox](https://github.com/nextcloud/android/assets/6813635/ca911d90-833a-4884-bf60-47a0821b5221)
![Screenshot_20240507_122814_Nextcloud](https://github.com/nextcloud/android/assets/6813635/e5589cd7-a9fb-4775-90a5-19425e45d994)

### Expected behaviour

App can check if file was uploaded successfully even with network errors and retries. At least final File size must be compared, better is to implement checksum comparison such as SHA256

### Actual behaviour

There is no file size or any checksum comparison after upload, if file was corrupted, user will never know about this issue till he need this file...

### Android version

14

### Device brand and model

Samsung Galaxy S21 FE

### Stock or custom OS?

Stock

### Nextcloud android app version

3.29.0

### Nextcloud server version

27.1.9

### Using a reverse proxy?

No

### Android logs

_No response_

### Server error logs

```json
{"reqId":"7BikhEPL8fyMuKuyfKUk","level":3,"time":"2024-05-07T10:26:07+00:00","remoteAddr":"256.256.256.256","user":"USER","app":"no app in context","method":"PUT","url":"/remote.php/dav/uploads/USER/c13848381ac9cc02b15f8c9ef9160fb2/000003","message":"Expected filesize of 40128855 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 31105024 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.29.0","version":"27.1.9.1","exception":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 40128855 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 31105024 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":149,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php","line":50,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Upload\\UploadFolder","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/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":368,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":172,"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":297,"message":"Expected filesize of 40128855 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 31105024 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 40128855 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 31105024 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side."},"id":"663a07385952c"}
```

Same as formatted JSON

```json
{
"app" : "no app in context",
"exception" : {
"Code" : 0,
"CustomMessage" : "Expected filesize of 40128855 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 31105024 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.",
"Exception" : "Sabre\\DAV\\Exception\\BadRequest",
"File" : "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
"Line" : 297,
"Message" : "Expected filesize of 40128855 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 31105024 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.",
"Trace" : [
{
"class" : "OCA\\DAV\\Connector\\Sabre\\File",
"file" : "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",
"function" : "put",
"line" : 149,
"type" : "->"
},
{
"args" : [
"*** sensitive parameters replaced ***"
],
"class" : "OCA\\DAV\\Connector\\Sabre\\Directory",
"file" : "/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php",
"function" : "createFile",
"line" : 50,
"type" : "->"
},
{
"args" : [
"*** sensitive parameters replaced ***"
],
"class" : "OCA\\DAV\\Upload\\UploadFolder",
"file" : "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
"function" : "createFile",
"line" : 1098,
"type" : "->"
},
{
"args" : [
"*** sensitive parameters replaced ***"
],
"class" : "Sabre\\DAV\\Server",
"file" : "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
"function" : "createFile",
"line" : 504,
"type" : "->"
},
{
"class" : "Sabre\\DAV\\CorePlugin",
"file" : "/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
"function" : "httpPut",
"line" : 89,
"type" : "->"
},
{
"class" : "Sabre\\DAV\\Server",
"file" : "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
"function" : "emit",
"line" : 472,
"type" : "->"
},
{
"class" : "Sabre\\DAV\\Server",
"file" : "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
"function" : "invokeMethod",
"line" : 253,
"type" : "->"
},
{
"class" : "Sabre\\DAV\\Server",
"file" : "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
"function" : "start",
"line" : 321,
"type" : "->"
},
{
"class" : "Sabre\\DAV\\Server",
"file" : "/var/www/nextcloud/apps/dav/lib/Server.php",
"function" : "exec",
"line" : 368,
"type" : "->"
},
{
"class" : "OCA\\DAV\\Server",
"file" : "/var/www/nextcloud/apps/dav/appinfo/v2/remote.php",
"function" : "exec",
"line" : 35,
"type" : "->"
},
{
"args" : [
"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"
],
"file" : "/var/www/nextcloud/remote.php",
"function" : "require_once",
"line" : 172
}
],
"exception" : [],
"message" : "Expected filesize of 40128855 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 31105024 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side."
},
"id" : "663a07385952c",
"level" : 3,
"message" : "Expected filesize of 40128855 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 31105024 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.",
"method" : "PUT",
"remoteAddr" : "256.256.256.256",
"reqId" : "7BikhEPL8fyMuKuyfKUk",
"time" : "2024-05-07T10:26:07+00:00",
"url" : "/remote.php/dav/uploads/USER/c13848381ac9cc02b15f8c9ef9160fb2/000003",
"user" : "USER",
"userAgent" : "Mozilla/5.0 (Android) Nextcloud-android/3.29.0",
"version" : "27.1.9.1"
}

```

### Additional information

I do not have laptop to access my phone with logcat during vacation.

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.