Coalesce empty query params to None in /node_startup_errors route

?source= or ?module_name= or ?pack_id= (param present but blank) would have returned {} because the helper treated the empty string as an exact-match filter. Coalesce to None at the route boundary so a present-but-blank query param behaves the same as the param being absent. The helper's own behaviour is unchanged and locked in by a new assertion.

Amp-Thread-ID: https://ampcode.com/threads/T-019e86fd-b68f-74de-8c91-d2662377424a
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Jedrzej Kosinski
2026-06-01 23:39:20 -07:00
parent 4eef53041e
commit 1339cb570d
2 changed files with 11 additions and 3 deletions

View File

@@ -795,10 +795,13 @@ class PromptServer():
result still returns ``{}`` with HTTP 200 rather than 404 — absence
of an error is a valid answer for this endpoint.
"""
# Coalesce empty-string query values to None so `?source=` (param
# present but blank) is treated the same as the param being absent
# — rather than filtering for entries whose source is literally "".
grouped = nodes.filter_node_startup_errors(
source=request.query.get("source"),
module_name=request.query.get("module_name"),
pack_id=request.query.get("pack_id"),
source=request.query.get("source") or None,
module_name=request.query.get("module_name") or None,
pack_id=request.query.get("pack_id") or None,
)
return web.json_response(grouped)