fix unescaped HTML in the tree node title, closes #1127

This commit is contained in:
zadam
2020-06-24 21:07:55 +02:00
parent 263b65997c
commit 89356918f1
2 changed files with 14 additions and 2 deletions

View File

@@ -64,8 +64,19 @@ function assertArguments() {
}
}
const entityMap = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
'/': '&#x2F;',
'`': '&#x60;',
'=': '&#x3D;'
};
function escapeHtml(str) {
return $('<div/>').text(str).html();
return str.replace(/[&<>"'`=\/]/g, s => entityMap[s]);
}
async function stopWatch(what, func) {