Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed computation of topic segments for MQTT DevFactory context #419

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tcalmant
Copy link
Contributor

@tcalmant tcalmant commented Jul 2, 2024

The MQTT device factory adds topic segments to the mapping context, e.g. foo/bar gives context.topic-0 set to foo.
This was failing if the the topic was starting with a /, e.g. /foo/bar.

This PR fixes the segmentation process, following the MQTT specification:

  • /foo, foo and foo/ are different
  • with a / prefix, context.topic-0 is always an empty string
  • with a / suffix, context.topic-last is always an empty string
  • foo/bar and foo//bar are equivalent, but foo/bar and foo/ /bar are different (and context.topic-1 will be a space character)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant