From 564128127b6aaf9b5522e97f808b5fb95f26d580 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 17 Mar 2026 18:33:55 -1000 Subject: [PATCH] [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" --- esphome/components/http_request/update/http_request_update.cpp | 2 ++ esphome/components/update/update_entity.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/http_request/update/http_request_update.cpp b/esphome/components/http_request/update/http_request_update.cpp index 981f1adac11..4c0ae916c28 100644 --- a/esphome/components/http_request/update/http_request_update.cpp +++ b/esphome/components/http_request/update/http_request_update.cpp @@ -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) } diff --git a/esphome/components/update/update_entity.h b/esphome/components/update/update_entity.h index 3b6d4fa2457..504efd5c6fd 100644 --- a/esphome/components/update/update_entity.h +++ b/esphome/components/update/update_entity.h @@ -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; };