Parcourir la source

[bugfix] trim html entities from text

B Thibault il y a 8 ans
Parent
commit
a5bd5a053d
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      msgFormatter.js

+ 3 - 1
msgFormatter.js

@@ -549,6 +549,8 @@ var formatText = (function() {
         }
     }
 
+    function htmlEntities(str) { return str.replace('<', "&lt;"); }
+
     function identity(a) { return a; }
 
     function linkidentity(str) {
@@ -573,7 +575,7 @@ var formatText = (function() {
             _opts = {};
         opts.highlights = _opts.highlights || [];
         opts.emojiFormatFunction = _opts.emojiFormatFunction || identity;
-        opts.textFilter = _opts.textFilter || identity;
+        opts.textFilter = _opts.textFilter || htmlEntities;
         opts.linkFilter = _opts.linkFilter || linkidentity;
         text = _text;