1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Properly escape html entities in debug

Fixes #276
This commit is contained in:
Nick O'Leary 2014-07-17 22:13:04 +01:00
parent 84a0e8ceff
commit f80c41058c
2 changed files with 4 additions and 4 deletions

View File

@ -400,7 +400,7 @@
}, },
button: { button: {
onclick: function() { onclick: function() {
var label = (this.name||this.payload).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"); var label = (this.name||this.payload).replace(/&/g,"&amp;amp;").replace(/</g,"&amp;lt;").replace(/>/g,"&amp;gt;");
d3.xhr("inject/"+this.id).post(function(err,resp) { d3.xhr("inject/"+this.id).post(function(err,resp) {
if (err) { if (err) {
if (err.status == 404) { if (err.status == 404) {

View File

@ -150,9 +150,9 @@
} }
}; };
var name = (o.name?o.name:o.id).toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"); var name = (o.name?o.name:o.id).toString().replace(/&/g,"&amp;amp;").replace(/</g,"&amp;lt;").replace(/>/g,"&amp;gt;");
var topic = (o.topic||"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"); var topic = (o.topic||"").toString().replace(/&/g,"&amp;amp;").replace(/</g,"&amp;lt;").replace(/>/g,"&amp;gt;");
var payload = (o.msg||"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"); var payload = (o.msg||"").toString().replace(/&/g,"&amp;amp;").replace(/</g,"&amp;lt;").replace(/>/g,"&amp;gt;");
msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'') msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'')
msg.innerHTML = '<span class="debug-message-date">'+getTimestamp()+'</span>'+ msg.innerHTML = '<span class="debug-message-date">'+getTimestamp()+'</span>'+
'<span class="debug-message-name">['+name+']</span>'+ '<span class="debug-message-name">['+name+']</span>'+