mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Debug message formatting mangling brackets
This commit is contained in:
@@ -156,7 +156,9 @@
|
||||
msg:msg
|
||||
});
|
||||
}
|
||||
|
||||
function sanitize(m) {
|
||||
return m.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
||||
}
|
||||
this.handleDebugMessage = function(t,o) {
|
||||
var msg = document.createElement("div");
|
||||
msg.onmouseover = function() {
|
||||
@@ -184,15 +186,17 @@
|
||||
}
|
||||
|
||||
};
|
||||
var name = (o.name?o.name:o.id).toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
||||
var topic = (o.topic||"").toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
||||
var property = (o.property?o.property:'').replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
||||
var payload = (o.msg||"()").toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
||||
var typ = payload.substring(0,payload.indexOf(')')+1);
|
||||
payload = payload.substring(payload.indexOf(')')+1);
|
||||
console.log(o);
|
||||
var name = sanitize(((o.name?o.name:o.id)||"").toString());
|
||||
var topic = sanitize((o.topic||"").toString());
|
||||
var property = sanitize(o.property?o.property:'');
|
||||
var payload = sanitize((o.msg||"").toString());
|
||||
var format = sanitize((o.format||"").toString());
|
||||
|
||||
msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'');
|
||||
msg.innerHTML = '<span class="debug-message-date">'+
|
||||
getTimestamp()+'</span><span class="debug-message-name">['+name+']'+
|
||||
getTimestamp()+'</span>'+
|
||||
(name?'<span class="debug-message-name">['+name+']':'')+
|
||||
'</span>';
|
||||
// NOTE: relying on function error to have a "type" that all other msgs don't
|
||||
if (o.hasOwnProperty("type") && (o.type === "function")) {
|
||||
@@ -205,8 +209,11 @@
|
||||
msg.className = 'debug-message debug-message-level-' + errorLvl;
|
||||
msg.innerHTML += '<span class="debug-message-topic">[function] : (' + errorLvlType + ')</span>';
|
||||
} else {
|
||||
msg.innerHTML += '<span class="debug-message-topic">'+(o.topic?topic+' : ':'')+
|
||||
(o.property?'[msg.'+property+']':'[msg]')+" : "+typ+'</span>';
|
||||
msg.innerHTML += '<span class="debug-message-topic">'+
|
||||
(o.topic?topic+' : ':'')+
|
||||
(o.property?'[msg.'+property+']':'[msg]')+" : "+format+
|
||||
|
||||
'</span>';
|
||||
}
|
||||
msg.innerHTML += '<span class="debug-message-payload">'+ payload+ '</span>';
|
||||
var atBottom = (sbc.scrollHeight-messages.offsetHeight-sbc.scrollTop) < 5;
|
||||
|
Reference in New Issue
Block a user