Clean up escaping of unsafe script characters

It seems that escaping `<` is sufficient
new-json-store-area
jeremy@jermolene.com 2021-06-27 21:42:25 +01:00
rodzic ce41aef2b3
commit 1a6ce4e5eb
1 zmienionych plików z 1 dodań i 10 usunięć

Wyświetl plik

@ -731,16 +731,7 @@ exports.getTiddlersAsJson = function(filter,options) {
json = JSON.stringify(data,null,spaces);
}
if(options.escapeUnsafeScriptCharacters) {
function escapeUnsafeChars(unsafeChar) {
return {
"<": "\\u003C",
">": "\\u003E",
"/": "\\u002F",
"\u2028": "\\u2028",
"\u2029": "\\u2029"
}[unsafeChar];
}
json = json.replace(/</g,escapeUnsafeChars);
json = json.replace(/</g,"\\u003C");
}
return json;
};