X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FBaseModule.php;h=619095dfb6fbaf019c669c309cc07c6fece29ec9;hb=e1863951986ba5be173758324a00652bc5af870c;hp=09107f04722c6a66754a706f73be772ce5a8193f;hpb=33ac39c33547984a9f32115155e435df1abc59c1;p=friendica.git diff --git a/src/BaseModule.php b/src/BaseModule.php index 09107f0472..619095dfb6 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -1,6 +1,6 @@ l10n->tt($singular, $plurarl, $count); + return $this->l10n->tt($singular, $plural, $count); } /** @@ -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,16 @@ 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->setStatus($e->getCode(), $e->getMessage()); + $this->response->addContent($httpException->content($e)); } finally { $this->profiler->set(microtime(true) - $timestamp, 'content'); }