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:18:11 +0000 |
commit | f5dec3702bed1d113977c5c7be943cfa9d4d5d73 (patch) | |
tree | 79d55bacfee41ea66427cf92e369c2c31e74cdfc /apps | |
parent | c8381c5d1710c420b2cefb0ae7131f46ca913001 (diff) | |
download | nextcloud-server-f5dec3702bed1d113977c5c7be943cfa9d4d5d73.tar.gz nextcloud-server-f5dec3702bed1d113977c5c7be943cfa9d4d5d73.zip |
Properly catch exception from writing to stream when copying a file
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-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 476824a2e36..36bcada0177 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -51,6 +51,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; @@ -199,8 +200,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; |