Skip to content

Commit

Permalink
type checks response_object, leaves unformatted if already json, re #…
Browse files Browse the repository at this point in the history
  • Loading branch information
whatisgalen committed Apr 19, 2024
1 parent 3f79e8f commit 72bd61d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions arches/app/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,15 @@ def search_results(request, returnDsl=False):
if search_filter:
search_filter.post_search_hook(search_results_object, ret, permitted_nodegroups)

for key, value in list(search_results_object.items()):
ret[key] = value

return JSONResponse(ret)
if isinstance(ret, dict):
for key, value in list(search_results_object.items()):
ret[key] = value
return JSONResponse(ret)
elif isinstance(ret, str): # response_object is json str, potentially from cache
return JSONResponse(content=ret, content_type="application/json")
else:
ret = {"message": _("Search Response Object malformed by one or more search filters")}
return JSONResponse(ret, status=500)

else:
ret = {"message": _("There was an error retrieving the search results")}
Expand Down

0 comments on commit 72bd61d

Please sign in to comment.