mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 03:24:33 +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;
|
return true;
|
||||||
}
|
}
|
||||||
|
// Check for e.g. foo/ matching foo/#
|
||||||
|
if (sPos == sLen - 2
|
||||||
|
&& filter[sPos] == LevelSeparator
|
||||||
|
&& filter[sPos + 1] == MultiLevelWildcard)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sPos++;
|
sPos++;
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ namespace MQTTnet.Tests
|
|||||||
CompareAndAssert("A/B/C/D", "A/C/#", false);
|
CompareAndAssert("A/B/C/D", "A/C/#", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TopicFilterComparer_EndMultipleLevelsWildcardMatchEmptyLevel()
|
||||||
|
{
|
||||||
|
CompareAndAssert("A/", "A/#", true);
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TopicFilterComparer_AllLevelsWildcardMatch()
|
public void TopicFilterComparer_AllLevelsWildcardMatch()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user