]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: log fopen calls when stream isn't available 37624/head
authorAnna Larch <anna@nextcloud.com>
Thu, 6 Apr 2023 18:10:38 +0000 (20:10 +0200)
committerAnna Larch <anna@nextcloud.com>
Thu, 20 Jul 2023 15:28:25 +0000 (17:28 +0200)
Signed-off-by: Anna Larch <anna@nextcloud.com>
lib/private/Streamer.php

index 52f824fedf8e4b33ebb52a57e110d40ad4529853..aafd3d95dfbcbf5597c1bd63b1783f1c14a3c962 100644 (file)
@@ -36,6 +36,7 @@ use OCP\Files\NotFoundException;
 use OCP\Files\NotPermittedException;
 use OCP\IRequest;
 use ownCloud\TarStreamer\TarStreamer;
+use Psr\Log\LoggerInterface;
 use ZipStreamer\ZipStreamer;
 
 class Streamer {
@@ -122,10 +123,16 @@ class Streamer {
                $dirNode = $userFolder->get($dir);
                $files = $dirNode->getDirectoryListing();
 
+               /** @var LoggerInterface $logger */
+               $logger = \OC::$server->query(LoggerInterface::class);
                foreach ($files as $file) {
                        if ($file instanceof File) {
                                try {
                                        $fh = $file->fopen('r');
+                                       if ($fh === false) {
+                                               $logger->error('Unable to open file for stream: ' . print_r($file, true));
+                                               continue;
+                                       }
                                } catch (NotPermittedException $e) {
                                        continue;
                                }