trimming composer input before doing length check in replies

v1.18.x
Julian Lam 8 years ago
parent ef6d52c01b
commit 576df84218

@ -3,6 +3,7 @@
var async = require('async');
var validator = require('validator');
var S = require('string');
var db = require('../database');
var utils = require('../../public/src/utils');
var plugins = require('../plugins');
@ -327,6 +328,9 @@ module.exports = function (Topics) {
}
function check(item, min, max, minError, maxError, callback) {
// Trim and remove HTML (latter for composers that send in HTML, like redactor)
item = S(item.trim()).stripTags().s;
if (!item || item.length < parseInt(min, 10)) {
return callback(new Error('[[error:' + minError + ', ' + min + ']]'));
} else if (item.length > parseInt(max, 10)) {

Loading…
Cancel
Save