Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions homeassistant/components/mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,8 @@ def _match_topic(subscription, topic):
if subscription.endswith('#'):
subscription = subscription[:-2]
suffix = "(.*)"
if subscription.startswith('$'):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this is the correct solution. Instead, we should call re.escape() on each part of the topic that's not +.

subscription = "\\" + subscription
sub_parts = subscription.split('/')
for sub_part in sub_parts:
if sub_part == "+":
Expand Down