diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-09-09 09:46:44 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-09-10 13:20:08 +0000 |
commit | 51b01cb054af4eb6988c9c3e037e4446bf297e1c (patch) | |
tree | 0eea3f146281bf06a17688a62038109452c7b4dd | |
parent | a3f4b6ba94893cdd448f05e5efc4935207d4c6e1 (diff) | |
download | nextcloud-server-51b01cb054af4eb6988c9c3e037e4446bf297e1c.tar.gz nextcloud-server-51b01cb054af4eb6988c9c3e037e4446bf297e1c.zip |
Properly catch exception from writing to stream when copying a file
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | apps/dav/lib/Connector/Sabre/File.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index a095d00c8a9..9d1dd910d01 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -49,6 +49,7 @@ use OCP\Encryption\Exceptions\GenericEncryptionException; use OCP\Files\EntityTooLargeException; use OCP\Files\FileInfo; use OCP\Files\ForbiddenException; +use OCP\Files\GenericFileException; use OCP\Files\InvalidContentException; use OCP\Files\InvalidPathException; use OCP\Files\LockNotAcquiredException; @@ -189,8 +190,14 @@ class File extends Node implements IFile { $isEOF = feof($stream); }); - $count = $partStorage->writeStream($internalPartPath, $wrappedData); - $result = $count > 0; + $result = true; + $count = -1; + try { + $count = $partStorage->writeStream($internalPartPath, $wrappedData); + } catch (GenericFileException $e) { + $result = false; + } + if ($result === false) { $result = $isEOF; |