diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-15 13:33:01 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-15 13:33:01 +0100 |
commit | 6a7be4d277a82ab8da297fbeae1e82a61338b649 (patch) | |
tree | 6bebdd152c2509704c1740d057862753dc30b264 /apps | |
parent | 6824704699a87dbccabe61319610141e7411b90e (diff) | |
parent | 43f5d8ab707fe6e6af10d6d5afba44587ff25825 (diff) | |
download | nextcloud-server-6a7be4d277a82ab8da297fbeae1e82a61338b649.tar.gz nextcloud-server-6a7be4d277a82ab8da297fbeae1e82a61338b649.zip |
Merge pull request #20927 from owncloud/handle-return-code-on-webdav-put
Handle return code of streamCopy in WebDAV put
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/connector/sabre/file.php | 10 |
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 4075c565f43..b925a670405 100644 --- a/apps/dav/lib/connector/sabre/file.php +++ b/apps/dav/lib/connector/sabre/file.php @@ -130,9 +130,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 |