Skip to content

Commit

Permalink
Fix for museumsvictoria#303 special characters break log (museumsvict…
Browse files Browse the repository at this point in the history
  • Loading branch information
mcartmel authored and scroix committed Apr 1, 2024
1 parent b0c1169 commit e3506f0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions nodel-webui-js/src/nodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ $.views.helpers({
sanitize: function(value, maxLength) {
var value = JSON.stringify(value, null, 2);
if (maxLength && value.length > maxLength) {
return value.substring(0, maxLength ) + "...";
value = value.substring(0, maxLength ) + "...";
}
value = value.replace("&","&");
value = value.replace("<","&lt;");
value = value.replace(">","&gt;");
return value;
return value.replace(/[<>&]/g, function (c) {
switch (c) {
case '<': return '&lt;';
case '>': return '&gt;';
case '&': return '&amp;';
}
});
},
nicetime: function (value, precise, format) {
if (precise) return moment(value).format('MM-DD HH:mm:ss.SS');
Expand Down

0 comments on commit e3506f0

Please sign in to comment.