From 576df8421895667eb0d088a9f4c3b84df0d66d27 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 21 Nov 2016 10:52:23 -0500 Subject: [PATCH] trimming composer input before doing length check in replies --- src/topics/create.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/topics/create.js b/src/topics/create.js index 21c5c3436a..e85db78630 100644 --- a/src/topics/create.js +++ b/src/topics/create.js @@ -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)) {