Permalink
Browse files

ErrorPresenter: renders 500.phtml only in HTML

  • Loading branch information...
dg committed Mar 6, 2018
1 parent cbf4f16 commit 526f603142591bbd937c141710b0d1eb35d4ab50
Showing with 5 additions and 2 deletions.
  1. +5 −2 app/presenters/ErrorPresenter.php
@@ -5,6 +5,7 @@
use Nette;
use Nette\Application\Responses;
use Nette\Http;
use Tracy\ILogger;
@@ -37,8 +38,10 @@ public function run(Nette\Application\Request $request): Nette\Application\IResp
}
$this->logger->log($e, ILogger::EXCEPTION);
return new Responses\CallbackResponse(function () {
require __DIR__ . '/templates/Error/500.phtml';
return new Responses\CallbackResponse(function (Http\IRequest $httpRequest, Http\IResponse $httpResponse) {
if (preg_match('#^text/html(?:;|$)#', $httpResponse->getHeader('Content-Type'))) {
require __DIR__ . '/templates/Error/500.phtml';
}
});
}
}

0 comments on commit 526f603

Please sign in to comment.