0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-08 09:42:43 +00:00

Move script tag sanitization to BrewRenderer

This commit is contained in:
G.Ambatte
2023-06-17 20:25:15 +12:00
parent a7a47afaae
commit b472fc1115
3 changed files with 7 additions and 17 deletions

View File

@@ -90,12 +90,6 @@ const escape = function (html, encode) {
return html;
};
const sanatizeScriptTags = (content)=>{
return content
.replace(/<script/ig, '&lt;script')
.replace(/<\/script>/ig, '&lt;/script&gt;');
};
const tagTypes = ['div', 'span', 'a'];
const tagRegex = new RegExp(`(${
_.map(tagTypes, (type)=>{
@@ -113,7 +107,7 @@ module.exports = {
marked : Markdown,
render : (rawBrewText)=>{
return Markdown(
sanatizeScriptTags(rawBrewText),
rawBrewText,
{ renderer: renderer }
);
},