[web_server] Remove deprecated object ID URL matching (#17113)

This commit is contained in:
J. Nick Koston
2026-06-21 14:45:03 -05:00
committed by GitHub
parent 1bd937d89c
commit 21aee91e67
2 changed files with 2 additions and 29 deletions

View File

@@ -164,36 +164,9 @@ EntityMatchResult UrlMatch::match_entity(EntityBase *entity) const {
} }
#endif #endif
// Try matching by entity name (new format) // Match by entity name
if (this->id == entity->get_name()) { if (this->id == entity->get_name()) {
result.matched = true; result.matched = true;
return result;
}
// Fall back to object_id (deprecated format)
char object_id_buf[OBJECT_ID_MAX_LEN];
StringRef object_id = entity->get_object_id_to(object_id_buf);
if (this->id == object_id) {
result.matched = true;
// Log deprecation warning
#ifdef USE_DEVICES
Device *device = entity->get_device();
if (device != nullptr) {
ESP_LOGW(TAG,
"Deprecated URL format: /%.*s/%.*s/%.*s - use entity name '/%.*s/%s/%s' instead. "
"Object ID URLs will be removed in 2026.7.0.",
(int) this->domain.size(), this->domain.c_str(), (int) this->device_name.size(),
this->device_name.c_str(), (int) this->id.size(), this->id.c_str(), (int) this->domain.size(),
this->domain.c_str(), device->get_name(), entity->get_name().c_str());
} else
#endif
{
ESP_LOGW(TAG,
"Deprecated URL format: /%.*s/%.*s - use entity name '/%.*s/%s' instead. "
"Object ID URLs will be removed in 2026.7.0.",
(int) this->domain.size(), this->domain.c_str(), (int) this->id.size(), this->id.c_str(),
(int) this->domain.size(), this->domain.c_str(), entity->get_name().c_str());
}
} }
return result; return result;

View File

@@ -76,7 +76,7 @@ struct UrlMatch {
bool method_equals(const __FlashStringHelper *str) const { return this->method == str; } bool method_equals(const __FlashStringHelper *str) const { return this->method == str; }
#endif #endif
/// Match entity by name first, then fall back to object_id with deprecation warning /// Match entity by name
/// Returns EntityMatchResult with match status and whether action segment is empty /// Returns EntityMatchResult with match status and whether action segment is empty
EntityMatchResult match_entity(EntityBase *entity) const; EntityMatchResult match_entity(EntityBase *entity) const;
}; };