We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 679b5d2 commit 0116b9bCopy full SHA for 0116b9b
1 file changed
docs/scripts/generate-csp.mjs
@@ -26,7 +26,8 @@ const BUILD_DIR = fileURLToPath(new URL('../build', import.meta.url));
26
// Anything else (e.g. application/ld+json structured data) is inert and needs no hash.
27
const EXECUTABLE_SCRIPT_TYPES = new Set(['', 'module', 'text/javascript', 'application/javascript']);
28
29
-const SCRIPT_TAG_REGEX = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
+// `\b[^>]*` tolerates end tags like `</script >`, which browsers accept as terminating
30
+const SCRIPT_TAG_REGEX = /<script\b([^>]*)>([\s\S]*?)<\/script\b[^>]*>/gi;
31
32
function collectHtmlFiles(dir) {
33
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
0 commit comments