Skip to content

Commit

Permalink
fix(Preview): Check strict _preview param value (allowing 0, `fal…
Browse files Browse the repository at this point in the history
…se` values to disable preview mode)
  • Loading branch information
ambroisemaupate committed Jun 23, 2023
1 parent 5bd821b commit 70b60c9
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ public function onKernelRequest(RequestEvent $event): void
if (
$event->isMainRequest() &&
$request->query->has(static::QUERY_PARAM_NAME) &&
(bool) ($request->query->get(static::QUERY_PARAM_NAME, 0)) === true
\in_array(
$request->query->get(static::QUERY_PARAM_NAME, 0),
['true', true, '1', 1, 'on', 'yes', 'y'],
true
)
) {
$request->attributes->set('preview', true);
}
Expand Down

0 comments on commit 70b60c9

Please sign in to comment.