aboutsummaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-03-03 09:40:43 +0100
committerJulius Härtl <jus@bitgrid.net>2023-03-03 09:40:43 +0100
commitbbc6eee8032061d3de5aced8da60e9342fd6047d (patch)
treed8ebc8edcefb05d7a53d7a87ebd9c69388ec346f /lib/base.php
parent26696c4deb50579d084df536cffbd3dea2e8a609 (diff)
downloadnextcloud-server-bbc6eee8032061d3de5aced8da60e9342fd6047d.tar.gz
nextcloud-server-bbc6eee8032061d3de5aced8da60e9342fd6047d.zip
fix: Avoid log spam on 404 routes not using GET
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php5
1 files changed, 4 insertions, 1 deletions
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'),