Fix XSS bug

This commit is contained in:
osmarks 2018-10-06 12:26:41 +01:00
parent 630640ced2
commit b6e972da47
1 changed files with 4 additions and 2 deletions

View File

@ -45,7 +45,7 @@
.channel {
font-weight: bold;
padding-right: 0.3em;
padding-right: 0.4em;
}
.timestamp {
@ -235,7 +235,9 @@ const viewMessage = m => {
children.push([ "span", { ...cls("channel"), style }, data.channel ])
}
if (data.message) {
children.push([ "span", cls("message"), data.message ])
let text = JSON.stringify(data.message, null, "\t");
if (typeof data.message === "string") { text = data.message }
children.push([ "span", cls("message"), text ])
}
if (data.time) {
children.push([ "span", cls("timestamp"), moment(data.time).format("hh:mm:ss") ])