From 7b42657d1e7ad19b516d5c9241053dd25f9349df Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 27 Dec 2022 20:08:33 +0100 Subject: [PATCH] Fix redirects --- src/BaseModule.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/BaseModule.php b/src/BaseModule.php index 12efbce811..11f884472e 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -243,6 +243,14 @@ abstract class BaseModule implements ICanHandleRequests $this->response->addContent($arr['content']); $this->response->addContent($this->content($request)); } catch (HTTPException $e) { + // In case of System::externalRedirects(), we don't want to prettyprint the exception + // just redirect to the new location + if (($e instanceof HTTPException\FoundException) || + ($e instanceof HTTPException\MovedPermanentlyException) || + ($e instanceof HTTPException\TemporaryRedirectException)) { + throw $e; + } + $this->response->addContent($httpException->content($e)); } finally { $this->profiler->set(microtime(true) - $timestamp, 'content');