mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-20 17:21:57 +01:00
Fix #213: Check if topic ends with slash
If this is not the case the subscription to the command topics will fail
This commit is contained in:
@@ -170,6 +170,13 @@ void WebApiMqttClass::onMqttAdminPost(AsyncWebServerRequest* request)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!root[F("mqtt_topic")].as<String>().endsWith("/")) {
|
||||||
|
retMsg[F("message")] = F("Topic must end with slash (/)!");
|
||||||
|
response->setLength();
|
||||||
|
request->send(response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (root[F("mqtt_port")].as<uint>() == 0 || root[F("mqtt_port")].as<uint>() > 65535) {
|
if (root[F("mqtt_port")].as<uint>() == 0 || root[F("mqtt_port")].as<uint>() > 65535) {
|
||||||
retMsg[F("message")] = F("Port must be a number between 1 and 65535!");
|
retMsg[F("message")] = F("Port must be a number between 1 and 65535!");
|
||||||
response->setLength();
|
response->setLength();
|
||||||
|
|||||||
Reference in New Issue
Block a user