diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-09-09 09:46:44 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-09-10 09:03:53 +0200 |
commit | 1dddf6adc7b7e4654679dbe30ccbae4ed6ad740b (patch) | |
tree | 6fc31e72f6435c091a4bca901e0a07a7836023f8 /apps/dav/lib/Connector/Sabre/File.php | |
parent | 9780c4f755830efc1495a8c79b3dfaa098406452 (diff) | |
download | nextcloud-server-1dddf6adc7b7e4654679dbe30ccbae4ed6ad740b.tar.gz nextcloud-server-1dddf6adc7b7e4654679dbe30ccbae4ed6ad740b.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/dav/lib/Connector/Sabre/File.php')
-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 ab6cd47ba5b..6a2bf6fe3a7 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -52,6 +52,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; @@ -200,8 +201,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; |