1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-27 13:48:49 +08:00

Fix regexp for SUB (#557)

Signed-off-by: drasko <drasko.draskovic@gmail.com>
This commit is contained in:
Drasko DRASKOVIC 2019-01-26 20:53:35 +01:00 committed by GitHub
parent 2c6379f823
commit 0b770ce49e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,7 @@ aedes.authorizePublish = function (client, packet, publish) {
aedes.authorizeSubscribe = function (client, packet, subscribe) {
// Topics are in the form `channels/<channel_id>/messages`
// Subtopic's are in the form `channels/<channel_id>/messages/<subtopic>`
var channel = /^channels\/(.+?)\/messages\/?(.+?)?$/.exec(packet.topic);
var channel = /^channels\/(.+?)\/messages\/?.*$/.exec(packet.topic);
if (!channel) {
logger.warn('unknown topic');
subscribe(4, packet); // Bad username or password