mirror of
https://github.com/esphome/esphome.git
synced 2026-02-28 18:04:19 -07:00
Restore hasArg guard in parse_string_param_
Empty string is a valid value for string params (e.g. select options). Must use hasArg to distinguish missing from empty.
This commit is contained in:
@@ -543,9 +543,8 @@ class WebServer : public Controller,
|
||||
template<typename T, typename Ret>
|
||||
void parse_string_param_(AsyncWebServerRequest *request, ParamNameType param_name, T &call,
|
||||
Ret (T::*setter)(const std::string &)) {
|
||||
const auto &value = request->arg(param_name);
|
||||
// Arduino String has isEmpty() not empty(), use length() for cross-platform compatibility
|
||||
if (value.length() > 0) { // NOLINT(readability-container-size-empty)
|
||||
if (request->hasArg(param_name)) {
|
||||
const auto &value = request->arg(param_name);
|
||||
(call.*setter)(std::string(value.c_str(), value.length()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user