Skip to content

Commit

Permalink
FIX Don't overwrite JSON errors with templated error page (#1334)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Aug 1, 2022
1 parent 8c6bc47 commit 523821b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion code/LeftAndMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,10 @@ protected function init()

public function afterHandleRequest()
{
if ($this->response->isError() && !$this->request->isAjax()) {
if ($this->response->isError()
&& !$this->request->isAjax()
&& $this->response->getHeader('Content-Type') !== 'application/json'
) {
$this->init();
$errorCode = $this->response->getStatusCode();
$errorType = $this->response->getStatusDescription();
Expand Down
1 change: 0 additions & 1 deletion tests/behat/features/notfound.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@gsat
Feature: Not found
As a site owner
I want error messages to be displayed in the context of the admin section
Expand Down

0 comments on commit 523821b

Please sign in to comment.