From 3ae95a606c9ce6aad0c0cd1a7bd50665bfe8fa41 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Tue, 20 Jan 2026 16:33:12 +0100 Subject: [PATCH] Handle `ResponseException` explicitly in `InsertTagsListener`. Do not catch ResponseException as they might provide an redirect or downloaded file. --- src/CoreBundle/EventListener/InsertTagsListener.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/CoreBundle/EventListener/InsertTagsListener.php b/src/CoreBundle/EventListener/InsertTagsListener.php index 17934feb2..e7c2523ba 100644 --- a/src/CoreBundle/EventListener/InsertTagsListener.php +++ b/src/CoreBundle/EventListener/InsertTagsListener.php @@ -24,6 +24,7 @@ namespace MetaModels\CoreBundle\EventListener; +use Contao\CoreBundle\Exception\ResponseException; use Contao\StringUtil; use Contao\Input; use Doctrine\DBAL\Connection; @@ -176,6 +177,10 @@ public function __invoke(string $insertTag): bool|int|string default: } } catch (\Exception $exc) { + if ($exc instanceof ResponseException) { + throw $exc; + } + $this->logger?->error( 'Error by replace tags: ' . $exc->getMessage() . ' | ' . __CLASS__ . ' | ' . __FUNCTION__ );