MatthewLavine / NodeJS-Chat

NodeJS based chat App
https://hardorange-chat.herokuapp.com/
MIT License
33 stars 11 forks source link

Little bug with BBCODE #20

Closed zosiazija closed 10 years ago

zosiazija commented 10 years ago

When you use bbcode it doesn't close the end tags properly i think it is because of the slash ("/") character in these functions:

//app.js
var entityMap = {
  "&": "&",
  "<": "&lt;",
  ">": "&gt;",
  '"': '&quot;',
  "'": '&#39;',
  "/": '&#x2F;'
};

function escapeHtml(string) {
  return String(string).replace(/[&<>"'\/]/g, function (s) {
    return entityMap[s];
  });
}

 bbcode.parse(escapeHtml(data.message), function(content){ ...

if you remove the slash in this functions, everything will be ok) you can test bbcode right now on your own chat)

MatthewLavine commented 10 years ago

Good catch, I have commited a fix for this bug. Reference: 7b5036277b87d11e4debf45e1139f19c7baf3b8d