Skip to content

Commit 547333f

Browse files
committed
omit html
1 parent 79f970e commit 547333f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/audits/render.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,10 @@ async function printAuditFail(result: AuditFail) {
119119
json = JSON.parse(text);
120120
// is json, there shouldnt be nothing to sanitize (hopefully)
121121
} catch {
122-
// is not json, sanitize probably html
123-
text.replace(
124-
/data-cf-beacon=('.*?'|".*?")/gm,
125-
'data-cf-beacon="<omitted>"',
126-
);
122+
// is not json, avoid rendering html (rest is allowed)
123+
if (res.headers.get('content-type')?.includes('text/html')) {
124+
text = '<html omitted>';
125+
}
127126
}
128127
const stringified = JSON.stringify(
129128
{

0 commit comments

Comments
 (0)