summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-12-03 15:27:56 +0100
committerVincent Petry <pvince81@owncloud.com>2016-01-11 12:13:01 +0100
commit43f5d8ab707fe6e6af10d6d5afba44587ff25825 (patch)
treec3c97e363b86c30cd6a6b4188e676f9ced3475df
parent94cf9e56b6c723c0dcc3c46cf66d6aaf3eaeecf3 (diff)
downloadnextcloud-server-43f5d8ab707fe6e6af10d6d5afba44587ff25825.tar.gz
nextcloud-server-43f5d8ab707fe6e6af10d6d5afba44587ff25825.zip
Handle return code of streamCopy in WebDAV put
* throw a different exception if streamCopy failed
-rw-r--r--apps/dav/lib/connector/sabre/file.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/dav/lib/connector/sabre/file.php b/apps/dav/lib/connector/sabre/file.php
index 6a0a39d04e7..fd4c7c67fce 100644
--- a/apps/dav/lib/connector/sabre/file.php
+++ b/apps/dav/lib/connector/sabre/file.php
@@ -129,9 +129,17 @@ class File extends Node implements IFile {
// because we have no clue about the cause we can only throw back a 500/Internal Server Error
throw new Exception('Could not write file contents');
}
- list($count,) = \OC_Helper::streamCopy($data, $target);
+ list($count, $result) = \OC_Helper::streamCopy($data, $target);
fclose($target);
+ if($result === false) {
+ $expected = -1;
+ if (isset($_SERVER['CONTENT_LENGTH'])) {
+ $expected = $_SERVER['CONTENT_LENGTH'];
+ }
+ throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: '. $expected .' )');
+ }
+
// if content length is sent by client:
// double check if the file was fully received
// compare expected and actual size