Skip to content

Commit

Permalink
Show preview toolbar on error pages (see #1210)
Browse files Browse the repository at this point in the history
Description
-----------

The preview toolbar is not present on any error page.

So in case you have a restricted webpage and the first page is a login form with HTTP code 401, not having the preview toolbar is an issue.

The preview toolbar should explicitly be available on pages with error code
- 401
- 403
- 404

I decided to allow any HTTP codes expect 300-399 (redirects) and 500-599 (server errors).

Commits
-------

61aaf093 Show preview toolbar on error pages
  • Loading branch information
richardhj authored and leofeyer committed Jan 17, 2020
1 parent d8a3d94 commit e48ce15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/EventListener/PreviewToolbarListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __invoke(ResponseEvent $event): void
$response = $event->getResponse();

// Do not capture redirects, errors, or modify XML HTTP Requests
if (!$response->isOk() || $request->isXmlHttpRequest()) {
if ($response->isRedirection() || $response->isServerError() || $request->isXmlHttpRequest()) {
return;
}

Expand Down

0 comments on commit e48ce15

Please sign in to comment.