Skip to content

Commit

Permalink
Make method nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Jan 19, 2024
1 parent 5e3f647 commit 054c0eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core-bundle/contao/library/Contao/TemplateTrait.php
Expand Up @@ -196,8 +196,13 @@ public function addCspHash(string $directive, string $script, string $algorithm
* Extracts all inline CSS style attributes of a given HTML string and automatically adds CSP hashes for those
* to the current response context.
*/
public function extractStyleAttributesForCsp(string $html): string
public function extractStyleAttributesForCsp(?string $html): null|string
{
if (!$html)
{
return $html;
}

$responseContext = System::getContainer()->get('contao.routing.response_context_accessor')->getResponseContext();

if (!$responseContext?->has(CspHandler::class))
Expand Down

0 comments on commit 054c0eb

Please sign in to comment.