diff --git a/packages/node_modules/@node-red/nodes/core/network/10-mqtt.js b/packages/node_modules/@node-red/nodes/core/network/10-mqtt.js index 3f5b2dff4..7ab624222 100644 --- a/packages/node_modules/@node-red/nodes/core/network/10-mqtt.js +++ b/packages/node_modules/@node-red/nodes/core/network/10-mqtt.js @@ -469,6 +469,7 @@ module.exports = function(RED) { this.broker = n.broker; this.brokerConn = RED.nodes.getNode(this.broker); var node = this; + var chk = /[\+#]/; if (this.brokerConn) { this.status({fill:"red",shape:"ring",text:"node-red:common.status.disconnected"}); @@ -487,6 +488,7 @@ module.exports = function(RED) { } if ( msg.hasOwnProperty("payload")) { if (msg.hasOwnProperty("topic") && (typeof msg.topic === "string") && (msg.topic !== "")) { // topic must exist + if (chk.test(msg.topic)) { node.warn(RED._("mqtt.errors.invalid-topic")); } this.brokerConn.publish(msg, done); // send the message } else { node.warn(RED._("mqtt.errors.invalid-topic"));