From: Morris Jobke Date: Mon, 29 Jul 2019 13:03:01 +0000 (+0200) Subject: More precise error message when expected filesize does not match - could be on readin... X-Git-Tag: v17.0.0beta1~66^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=13fd89575d554f33813c22212469f228815a2377;p=nextcloud-server.git More precise error message when expected filesize does not match - could be on reading or writing side Signed-off-by: Morris Jobke --- diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index d336df98306..dd25b046bcf 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -225,7 +225,7 @@ class File extends Node implements IFile { if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { $expected = (int)$_SERVER['CONTENT_LENGTH']; if ($count !== $expected) { - throw new BadRequest('expected filesize ' . $expected . ' got ' . $count); + throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $count . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.'); } } @@ -490,8 +490,7 @@ class File extends Node implements IFile { $expected = (int)$_SERVER['CONTENT_LENGTH']; if ($bytesWritten !== $expected) { $chunk_handler->remove($info['index']); - throw new BadRequest( - 'expected filesize ' . $expected . ' got ' . $bytesWritten); + throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $bytesWritten . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.'); } } }