diff --git a/src/messaging/create.js b/src/messaging/create.js index bd12a4c227..d78a0afe4c 100644 --- a/src/messaging/create.js +++ b/src/messaging/create.js @@ -23,7 +23,7 @@ module.exports = function (Messaging) { const maximumChatMessageLength = meta.config.maximumChatMessageLength || 1000; content = String(content).trim(); - let length = String(content.length).trim(); + let { length } = content; ({ content, length } = await plugins.hooks.fire('filter:messaging.checkContent', { content, length })); if (!content) { throw new Error('[[error:invalid-chat-message]]'); diff --git a/src/routes/helpers.js b/src/routes/helpers.js index 6366b4c8f5..2f928599bc 100644 --- a/src/routes/helpers.js +++ b/src/routes/helpers.js @@ -19,7 +19,8 @@ function _handleArgs(middleware, middlewares, controller) { middleware.registrationComplete, middleware.authenticateRequest, middleware.pluginHooks, - ...middlewares]; + ...middlewares, + ]; return { middlewares, controller }; }