|
@@ -705,7 +705,7 @@ class Utils {
|
|
*/
|
|
*/
|
|
static stripHtmlTags(htmlStr, removeScriptAndStyle=false) {
|
|
static stripHtmlTags(htmlStr, removeScriptAndStyle=false) {
|
|
if (removeScriptAndStyle) {
|
|
if (removeScriptAndStyle) {
|
|
- htmlStr = htmlStr.replace(/<(script|style)[^>]*>.*<\/(script|style)>/gmi, "");
|
|
|
|
|
|
+ htmlStr = htmlStr.replace(/<(script|style)[^>]*>.*?<\/(script|style)>/gi, "");
|
|
}
|
|
}
|
|
return htmlStr.replace(/<[^>]+>/g, "");
|
|
return htmlStr.replace(/<[^>]+>/g, "");
|
|
}
|
|
}
|
|
@@ -729,11 +729,10 @@ class Utils {
|
|
">": ">",
|
|
">": ">",
|
|
'"': """,
|
|
'"': """,
|
|
"'": "'", // ' not recommended because it's not in the HTML spec
|
|
"'": "'", // ' not recommended because it's not in the HTML spec
|
|
- "/": "/", // forward slash is included as it helps end an HTML entity
|
|
|
|
"`": "`"
|
|
"`": "`"
|
|
};
|
|
};
|
|
|
|
|
|
- return str.replace(/[&<>"'/`]/g, function (match) {
|
|
|
|
|
|
+ return str.replace(/[&<>"'`]/g, function (match) {
|
|
return HTML_CHARS[match];
|
|
return HTML_CHARS[match];
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -879,7 +878,7 @@ class Utils {
|
|
while ((m = recipeRegex.exec(recipe))) {
|
|
while ((m = recipeRegex.exec(recipe))) {
|
|
// Translate strings in args back to double-quotes
|
|
// Translate strings in args back to double-quotes
|
|
args = m[2]
|
|
args = m[2]
|
|
- .replace(/"/g, '\\"') // Escape double quotes
|
|
|
|
|
|
+ .replace(/"/g, '\\"') // Escape double quotes lgtm [js/incomplete-sanitization]
|
|
.replace(/(^|,|{|:)'/g, '$1"') // Replace opening ' with "
|
|
.replace(/(^|,|{|:)'/g, '$1"') // Replace opening ' with "
|
|
.replace(/([^\\]|(?:\\\\)+)'(,|:|}|$)/g, '$1"$2') // Replace closing ' with "
|
|
.replace(/([^\\]|(?:\\\\)+)'(,|:|}|$)/g, '$1"$2') // Replace closing ' with "
|
|
.replace(/\\'/g, "'"); // Unescape single quotes
|
|
.replace(/\\'/g, "'"); // Unescape single quotes
|