Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-09-09 10:46:44 +0300
committerJulius Härtl <jus@bitgrid.net>2020-09-10 10:03:53 +0300
commit1dddf6adc7b7e4654679dbe30ccbae4ed6ad740b (patch)
tree6fc31e72f6435c091a4bca901e0a07a7836023f8 /apps/dav/lib/Connector/Sabre/File.php
parent9780c4f755830efc1495a8c79b3dfaa098406452 (diff)
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.php11
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;