]> source.dussan.org Git - nextcloud-server.git/commitdiff
Properly catch exception from writing to stream when copying a file
authorJulius Härtl <jus@bitgrid.net>
Wed, 9 Sep 2020 07:46:44 +0000 (09:46 +0200)
committerJulius Härtl <jus@bitgrid.net>
Thu, 10 Sep 2020 07:03:53 +0000 (09:03 +0200)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
apps/dav/lib/Connector/Sabre/File.php

index ab6cd47ba5b385f695123c1eb071c2f08a58837a..6a2bf6fe3a7d4452ee2c33365352851e16d039db 100644 (file)
@@ -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;