check topic length > 0 before publish

to close #4414
This commit is contained in:
Dave Conway-Jones
2023-11-03 08:55:38 +00:00
parent 6ac905f264
commit 369bad01b8

View File

@@ -104,6 +104,7 @@ module.exports = function(RED) {
* @returns `true` if it is a valid topic
*/
function isValidPublishTopic(topic) {
if (topic.length === 0) return false;
return !/[\+#\b\f\n\r\t\v\0]/.test(topic);
}