Skip to content

Commit

Permalink
fix extractState when state is null (#2760)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShamazinGG authored Dec 11, 2023
1 parent d780d7f commit da2f736
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Screen/Screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,15 @@ public function asyncParticalLayout(Layout $layout, Request $request)
*/
protected function extractState(): Repository
{
$state = request()->post('_state', session()->get('_state'));
// Check if the '_state' parameter is missing
if (! request()->request->has('_state') && session()->missing('_state')) {
if ($state === null) {
// Return an empty Repository object
return new Repository();
}

// Extract the encrypted state from the '_state' parameter, and deserialize it
$raw = request()->post('_state') ?? session()->get('_state');

return Crypt::decrypt($raw);
//deserialize '_state' parameter
return Crypt::decrypt($state);
}

/**
Expand Down

0 comments on commit da2f736

Please sign in to comment.