From 3c5552db14ba58d4532272576a5982b0ae5b1322 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Thu, 18 Jun 2026 17:24:11 +0800 Subject: [PATCH] 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 --- xls2ddl/tmpls.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xls2ddl/tmpls.py b/xls2ddl/tmpls.py index 744a70f..70f95d7 100644 --- a/xls2ddl/tmpls.py +++ b/xls2ddl/tmpls.py @@ -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: