mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge pull request #4416 from node-red/mqtt-check-topic-length
check topic length > 0 before publish
This commit is contained in:
commit
c6a8eee73d
@ -104,6 +104,7 @@ module.exports = function(RED) {
|
|||||||
* @returns `true` if it is a valid topic
|
* @returns `true` if it is a valid topic
|
||||||
*/
|
*/
|
||||||
function isValidPublishTopic(topic) {
|
function isValidPublishTopic(topic) {
|
||||||
|
if (topic.length === 0) return false;
|
||||||
return !/[\+#\b\f\n\r\t\v\0]/.test(topic);
|
return !/[\+#\b\f\n\r\t\v\0]/.test(topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user