Skip to content

Commit

Permalink
Prevent error on CSRF token conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
adrenth committed Jun 8, 2020
1 parent d5bb04c commit 33fee18
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion middleware/VerifyCsrfTokenMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Illuminate\Routing\Redirector;
use October\Rain\Cookie\Middleware\EncryptCookies;
use RuntimeException;
use Throwable;

/**
* Class VerifyCsrfTokenMiddleware
Expand Down Expand Up @@ -124,6 +125,10 @@ private function getTokenFromRequest(Request $request): string
$token = $this->encrypter->decrypt($header, EncryptCookies::serialized('XSRF-TOKEN'));
}

return (string) $token;
try {
return (string) $token;
} catch (Throwable $e) {
return '';
}
}
}

0 comments on commit 33fee18

Please sign in to comment.