mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 18:21:40 -04:00
Merge pull request #37624 from nextcloud/fix/logging-for-failed-fopen
fix: log fopen calls when stream isn't available
This commit is contained in:
commit
ff2b36ad52
1 changed files with 7 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue