From b472fc111545cbae2a52703291562a971c3c2a17 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 17 Jun 2023 20:25:15 +1200 Subject: [PATCH] Move script tag sanitization to BrewRenderer --- client/homebrew/brewRenderer/brewRenderer.jsx | 8 +++++--- shared/naturalcrit/markdown.js | 8 +------- shared/naturalcrit/markdownLegacy.js | 8 +------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 48d02e7b3..76ef50b5c 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -141,18 +141,20 @@ const BrewRenderer = createClass({ renderStyle : function() { if(!this.props.style) return; + const cleanStyle = this.sanitizeScriptTags(this.props.style); //return
@layer styleTab {\n${this.sanitizeScriptTags(this.props.style)}\n} ` }} />; - return
${this.sanitizeScriptTags(this.props.style)} ` }} />; + return
${cleanStyle} ` }} />; }, renderPage : function(pageText, index){ + const cleanPageText = this.sanitizeScriptTags(pageText); if(this.props.renderer == 'legacy') - return
; + return
; else { pageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear) return (
-
+
); } diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 8848beb6b..3c05869e0 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -351,12 +351,6 @@ const escape = function (html, encode) { return html; }; -const sanatizeScriptTags = (content)=>{ - return content - .replace(/