Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 7d09bb3

Browse files
committed
Remove double sanitation in chat.
1 parent 631adb6 commit 7d09bb3

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

js/views/chatMessageVw.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
var __ = require('underscore'),
44
$ = require('jquery'),
55
moment = require('moment'),
6-
sanitizeHTML = require('sanitize-html'),
76
loadTemplate = require('../utils/loadTemplate'),
87
app = require('../App.js').getApp(),
98
baseVw = require('./baseVw');
@@ -29,19 +28,11 @@ module.exports = baseVw.extend({
2928

3029
render: function(){
3130
var sanitizedMsg,
31+
msgTxt = this.model.get('message'),
3232
$msg;
3333

34-
sanitizedMsg = sanitizeHTML(this.model.get('message').replace(/\n$/, '').split(/[\r\n]/g).join('<br/><br/>'), {
35-
allowedTags: [ 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'a', 'u', 'ul', 'ol', 'nl', 'li', 'b', 'i', 'strong', 'em', 'strike', 'hr', 'br', 'img' ],
36-
allowedAttributes: {
37-
'a': [ 'href', 'title', 'alt' ],
38-
'img': [ 'src', 'style']
39-
},
40-
allowedSchemes: [ 'http', 'https', 'ftp', 'mailto', 'ob' ]
41-
});
42-
4334
// add js-externalLink class to any links in the message text
44-
$msg = $('<div>' + sanitizedMsg + '</div>');
35+
$msg = $('<div>' + msgTxt + '</div>');
4536
$msg.find('a').addClass('js-externalLink');
4637
sanitizedMsg = $msg.html();
4738

0 commit comments

Comments
 (0)