Browse Source

Merge pull request #34035 from nextcloud/fix/do-not-log-warning-on-404

Do not output a warning when a file is not found
tags/v25.0.0beta7
Vincent Petry 1 year ago
parent
commit
ee183efd46
No account linked to committer's email address
1 changed files with 1 additions and 6 deletions
  1. 1
    6
      apps/dav/lib/DAV/ViewOnlyPlugin.php

+ 1
- 6
apps/dav/lib/DAV/ViewOnlyPlugin.php View File



use OCA\DAV\Connector\Sabre\Exception\Forbidden; use OCA\DAV\Connector\Sabre\Exception\Forbidden;
use OCA\DAV\Connector\Sabre\File as DavFile; use OCA\DAV\Connector\Sabre\File as DavFile;
use OCA\DAV\Meta\MetaFile;
use OCP\Files\FileInfo;
use OCP\Files\NotFoundException; use OCP\Files\NotFoundException;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Sabre\DAV\Server; use Sabre\DAV\Server;
* Sabre plugin for restricting file share receiver download: * Sabre plugin for restricting file share receiver download:
*/ */
class ViewOnlyPlugin extends ServerPlugin { class ViewOnlyPlugin extends ServerPlugin {

private ?Server $server = null; private ?Server $server = null;
private LoggerInterface $logger; private LoggerInterface $logger;


throw new Forbidden('Access to this resource has been denied because it is in view-only mode.'); throw new Forbidden('Access to this resource has been denied because it is in view-only mode.');
} }
} catch (NotFound $e) { } catch (NotFound $e) {
$this->logger->warning($e->getMessage(), [
'exception' => $e,
]);
// File not found
} }


return true; return true;

Loading…
Cancel
Save