소스 검색

[bugfix] trim html entities from text

B Thibault 8 년 전
부모
커밋
a5bd5a053d
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  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;