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
path: root/apps/dav
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-09-09 10:46:44 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-09-10 16:18:11 +0300
commitf5dec3702bed1d113977c5c7be943cfa9d4d5d73 (patch)
tree79d55bacfee41ea66427cf92e369c2c31e74cdfc /apps/dav
parentc8381c5d1710c420b2cefb0ae7131f46ca913001 (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')
-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 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;