Permalink
Browse files

ErrorPresenter: renders 500.phtml only in HTML

  • Loading branch information...
dg committed Mar 6, 2018
1 parent 286fc3b commit 913d84cb3fbaa3a3a50e2744a290d54032c8d703
Showing with 5 additions and 2 deletions.
  1. +5 −2 app/presenters/ErrorPresenter.php
@@ -6,6 +6,7 @@
use Nette;
use Nette\Application\Responses;
use Nette\Http;
use Tracy\ILogger;
@@ -33,8 +34,10 @@ public function run(Nette\Application\Request $request): Nette\Application\IResp
}
$this->logger->log($exception, 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 913d84c

Please sign in to comment.