mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Handle return code of streamCopy in WebDAV put
* throw a different exception if streamCopy failed
This commit is contained in:
parent
94cf9e56b6
commit
43f5d8ab70
1 changed files with 9 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue