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

This commit is contained in:
Bryan 2024-03-07 12:37:12 +08:00 committed by GitHub
parent 4582aa0a09
commit a2701090de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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