]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: Avoid log spam on 404 routes not using GET 37026/head
authorJulius Härtl <jus@bitgrid.net>
Fri, 3 Mar 2023 08:40:43 +0000 (09:40 +0100)
committerJulius Härtl <jus@bitgrid.net>
Fri, 3 Mar 2023 08:40:43 +0000 (09:40 +0100)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/base.php

index b5c5845b5a0ca735769fa25761677bded889a894..be931e70d5581eed9cfb13a67d74c276db0c22ba 100644 (file)
@@ -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'),