mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-07-25 02:31:25 +02:00
Fix content security policy failure due to <script> tags without nonce generated by HtmlDumper (#563)
This commit is contained in:
committed by
GitHub
parent
1bee671914
commit
61d4cad24b
@@ -1046,6 +1046,10 @@ class JavascriptRenderer
|
||||
|
||||
$nonce = $this->getNonceAttribute();
|
||||
|
||||
if ($nonce != '') {
|
||||
$js = preg_replace("/<script>/", "<script nonce='{$this->cspNonce}'>", $js);
|
||||
}
|
||||
|
||||
if ($this->useRequireJs){
|
||||
return "<script type=\"text/javascript\"{$nonce}>\nrequire(['debugbar'], function(PhpDebugBar){ $js });\n</script>\n";
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user