Skip to content

Commit ab34701

Browse files
committed
fix bug where "undefined" would be appeneded to body in rewritten html when there was a csp meta tag
1 parent d73c229 commit ab34701

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/shared/rewriters/html.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ElementType, Parser } from "htmlparser2";
2-
import { ChildNode, DomHandler, Element } from "domhandler";
2+
import { ChildNode, DomHandler, Element, Comment } from "domhandler";
33
import render from "dom-serializer";
44
import { URLMeta, rewriteUrl } from "./url";
55
import { rewriteCss } from "./css";
@@ -319,7 +319,8 @@ function traverseParsedHtml(
319319
if (
320320
node.attribs["http-equiv"].toLowerCase() === "content-security-policy"
321321
) {
322-
node = {};
322+
// just delete it. this needs to be emulated eventually but like
323+
node = new Comment(node.attribs.content);
323324
} else if (
324325
node.attribs["http-equiv"] === "refresh" &&
325326
node.attribs.content.includes("url")

0 commit comments

Comments
 (0)