mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 00:15:15 +08:00
The topic filter comparer now checks for e.g. "foo/" matching "foo/#".
This commit is contained in:
@@ -31,6 +31,13 @@ namespace MQTTnet.Server
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Check for e.g. foo/ matching foo/#
|
||||
if (sPos == sLen - 2
|
||||
&& filter[sPos] == LevelSeparator
|
||||
&& filter[sPos + 1] == MultiLevelWildcard)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
sPos++;
|
||||
|
||||
@@ -54,6 +54,12 @@ namespace MQTTnet.Tests
|
||||
CompareAndAssert("A/B/C/D", "A/C/#", false);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TopicFilterComparer_EndMultipleLevelsWildcardMatchEmptyLevel()
|
||||
{
|
||||
CompareAndAssert("A/", "A/#", true);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TopicFilterComparer_AllLevelsWildcardMatch()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user