1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix too specific wildcard matching in MQTT node

This commit is contained in:
Nick O'Leary 2014-02-23 20:14:27 +00:00
parent a44104a7e4
commit f81ebf0e64

View File

@ -20,7 +20,10 @@ var settings = require(process.env.NODE_RED_HOME+"/red/red").settings;
var connections = {};
function matchTopic(ts,t) {
var re = new RegExp("^"+ts.replace(/([\[\]\?\(\)\\\\$\^\*\.|])/g,"\\$1").replace(/\+/g,"[^/]+").replace(/#$/,".*")+"$");
if (ts == "#") {
return true;
}
var re = new RegExp("^"+ts.replace(/([\[\]\?\(\)\\\\$\^\*\.|])/g,"\\$1").replace(/\+/g,"[^/]+").replace(/\/#$/,"(\/.*)?")+"$");
return re.test(t);
}