aboutsummaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-03-03 09:40:43 +0100
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2023-03-07 09:56:12 +0000
commita5607754cff27ea7ba17e662ed554d5fe8b36a40 (patch)
tree3efc3c80d6630d31c45330564cb344f4537884fc /lib/base.php
parentbc759977d2a7c663ccb527046ab10f5167affb38 (diff)
downloadnextcloud-server-a5607754cff27ea7ba17e662ed554d5fe8b36a40.tar.gz
nextcloud-server-a5607754cff27ea7ba17e662ed554d5fe8b36a40.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'),