aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-07-28 12:59:52 +0200
committerGitHub <noreply@github.com>2023-07-28 12:59:52 +0200
commitff2b36ad5258160a6c1cf3f95d78b2fec0f8c879 (patch)
tree848a2e25af36655b9555e952f62af5a5cf5d3b67
parentf3bdcfd4272f6caeac1fc5d78aa93cdca2f5d519 (diff)
parent70a6eeed3e891bbe1a12aae4edcc30596a72e680 (diff)
downloadnextcloud-server-ff2b36ad5258160a6c1cf3f95d78b2fec0f8c879.tar.gz
nextcloud-server-ff2b36ad5258160a6c1cf3f95d78b2fec0f8c879.zip
Merge pull request #37624 from nextcloud/fix/logging-for-failed-fopen
fix: log fopen calls when stream isn't available
-rw-r--r--lib/private/Streamer.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/private/Streamer.php b/lib/private/Streamer.php
index 52f824fedf8..aafd3d95dfb 100644
--- a/lib/private/Streamer.php
+++ b/lib/private/Streamer.php
@@ -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;
}