mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
chore: enhance re_findall function to handle None and empty string patterns
This commit is contained in:
parent
0b72c5d4c2
commit
679276bd17
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue