Wildcard check bug in TMS.MQTT.Topics : ValidateTopicFilter

Hi all,

There is a bug in the ValidateTopicFilter function in TMS.MQTT.Topics which prevent to use the + wildcard as first character (ex : +/info)

the code :

if ContainsSingleLevelWildcardCharacter(ATopicFilter) then
begin
if (Length(ATopicFilter) > 1) then // '+' character as only character is valid
begin
for I := Low(ATopicFilter) to High(ATopicFilter) do
begin
if (ATopicFilter[I] = '+') then
begin

if (I > 0) then
begin
if not(ATopicFilter[I - 1] = '/') then
begin
Result := false;
Exit;
end;
end;

should be rectified like that

if ContainsSingleLevelWildcardCharacter(ATopicFilter) then
begin
if (Length(ATopicFilter) > 1) then // '+' character as only character is valid
begin
for I := Low(ATopicFilter) to High(ATopicFilter) do
begin
if (ATopicFilter[I] = '+') then
begin

if (I > Low(ATopicFilter)) then
begin
if not(ATopicFilter[I - 1] = '/') then
begin
Result := false;
Exit;
end;
end;

Thanks for reporting.
You're correct about this issue and suggested fix.
We'll synchronize and release an update