From 679276bd17f6942a886b7613e50e2b51ed1a2e5d Mon Sep 17 00:00:00 2001 From: CaptainB Date: Fri, 10 Oct 2025 10:35:59 +0800 Subject: [PATCH] chore: enhance re_findall function to handle None and empty string patterns --- apps/common/utils/split_model.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/common/utils/split_model.py b/apps/common/utils/split_model.py index eff9cc18f..f1365ad56 100644 --- a/apps/common/utils/split_model.py +++ b/apps/common/utils/split_model.py @@ -169,7 +169,12 @@ def parse_level(text, pattern: str): def re_findall(pattern, text): - if not pattern or not pattern.strip(): + # 检查 pattern 是否为空或无效 + if pattern is None: + return [] + + # 如果是字符串类型,检查是否为空字符串 + if isinstance(pattern, str) and (not pattern or not pattern.strip()): return [] try: