From: Julius Härtl Date: Fri, 3 Mar 2023 08:40:43 +0000 (+0100) Subject: fix: Avoid log spam on 404 routes not using GET X-Git-Tag: v27.0.0beta1~372^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bbc6eee8032061d3de5aced8da60e9342fd6047d;p=nextcloud-server.git fix: Avoid log spam on 404 routes not using GET Signed-off-by: Julius Härtl --- diff --git a/lib/base.php b/lib/base.php index b5c5845b5a0..be931e70d55 100644 --- a/lib/base.php +++ b/lib/base.php @@ -80,6 +80,7 @@ use OCP\Server; use OCP\Share; use OCP\User\Events\UserChangedEvent; use Psr\Log\LoggerInterface; +use Symfony\Component\Routing\Exception\MethodNotAllowedException; use function OCP\Log\logger; require_once 'public/Constants.php'; @@ -1097,7 +1098,9 @@ class OC { try { Server::get(\OC\Route\Router::class)->match('/error/404'); } catch (\Exception $e) { - logger('core')->emergency($e->getMessage(), ['exception' => $e]); + if (!$e instanceof MethodNotAllowedException) { + logger('core')->emergency($e->getMessage(), ['exception' => $e]); + } $l = Server::get(\OCP\L10N\IFactory::class)->get('lib'); OC_Template::printErrorPage( $l->t('404'),