mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Use new validation option to return better label
Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>
This commit is contained in:
parent
be3b5b7fe2
commit
9b644e3c47
@ -457,11 +457,11 @@
|
|||||||
* @param {string} topic
|
* @param {string} topic
|
||||||
* @returns `true` if it is a valid topic
|
* @returns `true` if it is a valid topic
|
||||||
*/
|
*/
|
||||||
function validateMQTTPublishTopic(topic) {
|
function validateMQTTPublishTopic(topic, opts) {
|
||||||
if(!topic || topic == "") {
|
if(!topic || topic == "" || !/[\+#\b\f\n\r\t\v\0]/.test(topic)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !/[\+#\b\f\n\r\t\v\0]/.test(topic);
|
return RED._("node-red:mqtt.errors.invalid-topic");
|
||||||
}
|
}
|
||||||
RED.nodes.registerType('mqtt-broker',{
|
RED.nodes.registerType('mqtt-broker',{
|
||||||
category: 'config',
|
category: 'config',
|
||||||
|
Loading…
Reference in New Issue
Block a user