Skip to content

Commit

Permalink
fix(v3 client): topic length mismatch on matching topics
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Jan 25, 2022
1 parent c8c04c6 commit 7d2cfa1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mqtt
version: 1.2.0
version: 1.2.1
crystal: ">= 0.36.1"

authors:
Expand Down
4 changes: 2 additions & 2 deletions src/mqtt/v3/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ module MQTT
# https://emqx.medium.com/introduction-to-mqtt-5-0-protocol-shared-subscription-4c23e7e0e3c1
filter_array = filter_array[2..-1] if filter_array.first? == "$share"
topic_array = topic.split("/")
length = filter_array.size

# Normalise the strings
filter_array.shift if filter_array[0].empty?
topic_array.shift if topic_array[0].empty?
filter_array.shift if filter_array[0].empty?
length = filter_array.size

filter_array.each_with_index do |left, index|
right = topic_array[index]?
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt/v3/connack.cr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module MQTT

def success!
return self if success?
raise (REFUSAL_CODES[return_code]? || "Connection refused: error code #{return_code}")
raise(REFUSAL_CODES[return_code]? || "Connection refused: error code #{return_code}")
end
end
end # V3
Expand Down

0 comments on commit 7d2cfa1

Please sign in to comment.