X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FBaseModule.php;h=11f884472e65c448c774d6b8f1576ef986903bac;hb=10f8631cd9423629d5189ae71d82964e4db18892;hp=09107f04722c6a66754a706f73be772ce5a8193f;hpb=ab9b60b9d22306d4e52648c582f3b2dd5d2cc120;p=friendica.git diff --git a/src/BaseModule.php b/src/BaseModule.php index 09107f0472..11f884472e 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -181,7 +181,7 @@ abstract class BaseModule implements ICanHandleRequests /** * {@inheritDoc} */ - public function run(array $request = []): ResponseInterface + public function run(ModuleHTTPException $httpException, array $request = []): ResponseInterface { // @see https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/config/initializers/cors.rb if (substr($this->args->getQueryString(), 0, 12) == '.well-known/') { @@ -243,7 +243,15 @@ abstract class BaseModule implements ICanHandleRequests $this->response->addContent($arr['content']); $this->response->addContent($this->content($request)); } catch (HTTPException $e) { - $this->response->addContent((new ModuleHTTPException())->content($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'); }