Fix: Dont allow HA base topic without trailing slash

This commit is contained in:
Thomas Basler
2025-05-20 19:44:59 +02:00
parent 4e0685ea13
commit 27d28090d5
9 changed files with 15 additions and 0 deletions

View File

@@ -268,6 +268,13 @@ void WebApiMqttClass::onMqttAdminPost(AsyncWebServerRequest* request)
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
return;
}
if (!root["mqtt_hass_topic"].as<String>().endsWith("/")) {
retMsg["message"] = "Hass topic must end with a slash (/)!";
retMsg["code"] = WebApiError::MqttHassTopicTrailingSlash;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
return;
}
}
}