fix: 修复连接 Token 时报错的问题((1139, "Got error empty (sub)expression from regexp")) (#12768)

pull/12773/head
Bryan 2024-03-07 12:37:33 +08:00 committed by GitHub
parent b3e73605b0
commit b9422c096e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -73,6 +73,10 @@ class FamilyMixin:
@classmethod
def get_nodes_all_children(cls, nodes, with_self=True):
pattern = cls.get_nodes_children_key_pattern(nodes, with_self=with_self)
if not pattern:
# 如果 pattern = ''
# key__iregex 报错 (1139, "Got error 'empty (sub)expression' from regexp")
return cls.objects.none()
return Node.objects.filter(key__iregex=pattern)
@classmethod