fix: add data_filter field definition guard to CRUD template

- Check if filterjson is CRUD field definition ({'fields': [...]})
- Set filterjson to None to avoid DBFilter AssertionError
- Fixes issue where data_filter parameter causes 500 error
This commit is contained in:
Hermes Agent 2026-06-18 17:24:11 +08:00
parent 3f8a0ce876
commit 3c5552db14

View File

@ -154,6 +154,9 @@ if filterjson and isinstance(filterjson, str):
\t\tfilterjson = json.loads(filterjson)
\texcept (json.JSONDecodeError, TypeError):
\t\tfilterjson = None
# data_filter可能是CRUD字段定义({"fields":[...]}),不是过滤条件,忽略
if filterjson and isinstance(filterjson, dict) and 'fields' in filterjson:
filterjson = None
fields_str=r'''{{json.dumps(fields, indent=4, ensure_ascii=False)}}'''
ori_fields = json.loads(fields_str)
if not filterjson: