X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/253f386f006eb0bcdf1151008b75213e96c4edf9..refs/pull/5663/head:/app/Theming/CustomHtmlHeadContentProvider.php diff --git a/app/Theming/CustomHtmlHeadContentProvider.php b/app/Theming/CustomHtmlHeadContentProvider.php index 6110d5a60..95d9ff5ad 100644 --- a/app/Theming/CustomHtmlHeadContentProvider.php +++ b/app/Theming/CustomHtmlHeadContentProvider.php @@ -33,9 +33,10 @@ class CustomHtmlHeadContentProvider { $content = $this->getSourceContent(); $hash = md5($content); - $html = $this->cache->remember('custom-head-web:' . $hash, 86400, function() use ($content) { + $html = $this->cache->remember('custom-head-web:' . $hash, 86400, function () use ($content) { return HtmlNonceApplicator::prepare($content); }); + return HtmlNonceApplicator::apply($html, $this->cspService->getNonce()); } @@ -47,8 +48,9 @@ class CustomHtmlHeadContentProvider { $content = $this->getSourceContent(); $hash = md5($content); - return $this->cache->remember('custom-head-export:' . $hash, 86400, function() use ($content) { - return HtmlContentFilter::removeScripts($content); + + return $this->cache->remember('custom-head-export:' . $hash, 86400, function () use ($content) { + return HtmlContentFilter::removeScriptsFromHtmlString($content); }); } @@ -59,5 +61,4 @@ class CustomHtmlHeadContentProvider { return setting('app-custom-head', ''); } - -} \ No newline at end of file +}