mirror of
https://github.com/esphome/esphome.git
synced 2026-09-23 21:14:03 +00:00
[http_request] Call container->end() on non-OK status, fix comment
Address Copilot review feedback: - Call container->end() when status_code != HTTP_STATUS_OK (pre-existing bug, but easy to fix while we're here) - Update error_str comment to say "update check failure" not "fetch failure"
This commit is contained in:
@@ -85,6 +85,8 @@ void HttpRequestUpdate::update_task(void *params) {
|
||||
|
||||
if (container == nullptr || container->status_code != HTTP_STATUS_OK) {
|
||||
ESP_LOGE(TAG, "Failed to fetch manifest from %s", this_update->source_url_.c_str());
|
||||
if (container != nullptr)
|
||||
container->end();
|
||||
info->error_str = LOG_STR("Failed to fetch manifest");
|
||||
goto defer; // NOLINT(cppcoreguidelines-avoid-goto)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ struct UpdateInfo {
|
||||
std::string release_url;
|
||||
std::string firmware_url;
|
||||
std::string md5;
|
||||
const LogString *error_str{nullptr}; // Set on fetch failure, nullptr on success
|
||||
const LogString *error_str{nullptr}; // Set on update check failure, nullptr on success
|
||||
bool has_progress{false};
|
||||
float progress;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user