fix: handle list-shape data in Firecrawl /search response (#24712)

Firecrawl /search returns either `{"data": [...]}` (flat list — v1, and
what frost19k reported on #23966) or `{"data": {"web": [...]}}` (v2,
current production). The parser only handled the dict shape:

    data = response.get('data') or {}
    results = data.get('web') or []

On a list-shape response, `data.get('web')` raised AttributeError,
caught by the function's outer try/except, and `search_firecrawl`
silently returned []. Web search worked against v2 endpoints but is one
upstream-format-change away from failing closed again. Accept either.
This commit is contained in:
Classic298
2026-06-01 21:07:31 +02:00
committed by GitHub
parent 507b8b213c
commit e623081b2b

View File

@@ -197,8 +197,11 @@ def search_firecrawl(
},
timeout=count * 3 + 10,
)
# Firecrawl /search has historically returned both `{"data": [...]}`
# (flat list, what v1 did and what frost19k reported under #23966)
# and `{"data": {"web": [...]}}` (current v2). Accept either.
data = response.get('data') or {}
results = data.get('web') or []
results = data if isinstance(data, list) else (data.get('web') or [])
if filter_list:
from open_webui.retrieval.web.main import get_filtered_results