Skip to content

Commit

Permalink
fix: log fopen calls when stream isn't available
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Larch <[email protected]>
  • Loading branch information
miaulalala committed Jul 20, 2023
1 parent ec4ae84 commit 70a6eee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/private/Streamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCP\Files\NotPermittedException;
use OCP\IRequest;
use ownCloud\TarStreamer\TarStreamer;
use Psr\Log\LoggerInterface;
use ZipStreamer\ZipStreamer;

class Streamer {
Expand Down Expand Up @@ -122,10 +123,16 @@ public function addDirRecursive(string $dir, string $internalDir = ''): void {
$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;
}
Expand Down

0 comments on commit 70a6eee

Please sign in to comment.