From adfc22ae85b2b522007b3ef63226eb99e37d0487 Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 9 Jun 2023 18:32:56 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=AE=E5=A4=8D=20=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/db/fields.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/common/db/fields.py b/apps/common/db/fields.py index adc3a3b89..41c2cf357 100644 --- a/apps/common/db/fields.py +++ b/apps/common/db/fields.py @@ -468,7 +468,12 @@ class JSONManyToManyDescriptor: elif rule_match == 'endswith': res &= str(value).endswith(str(rule_value)) elif rule_match == 'regex': - res &= re.match(rule_value, value) + try: + matched = bool(re.match(rule_value, value)) + except Exception as e: + logging.error('Error regex match: %s', e) + matched = False + res &= matched elif rule_match == 'not': res &= value != rule_value elif rule['match'] == 'gte':