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 86dd16c commit 1c0423bCopy full SHA for 1c0423b
.changeset/heavy-eels-wash.md
@@ -0,0 +1,5 @@
1
+---
2
+'@sveltejs/kit': patch
3
4
+
5
+fix: do not add content-security-policy meta element if content is empty
packages/kit/src/runtime/server/page/csp.js
@@ -178,8 +178,13 @@ class BaseProvider {
178
179
class CspProvider extends BaseProvider {
180
get_meta() {
181
- const content = escape_html_attr(this.get_header(true));
182
- return `<meta http-equiv="content-security-policy" content=${content}>`;
+ const content = this.get_header(true);
183
+ if (!content) {
184
+ return;
185
+ }
186
187
+ return `<meta http-equiv="content-security-policy" content=${escape_html_attr(content)}>`;
188
}
189
190
0 commit comments