From 36e01a316c12e63eb9e51f0c374503afaa50ce2a Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Tue, 19 Aug 2025 15:48:22 +0800 Subject: [PATCH] perf: Regular command groups can be filled in with new lines --- apps/acls/models/command_acl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/acls/models/command_acl.py b/apps/acls/models/command_acl.py index f4d05007b..148463de6 100644 --- a/apps/acls/models/command_acl.py +++ b/apps/acls/models/command_acl.py @@ -34,16 +34,16 @@ class CommandGroup(JMSOrgBaseModel): @lazyproperty def pattern(self): + content = self.content.replace('\r\n', '\n') if self.type == 'command': - s = self.construct_command_regex(self.content) + s = self.construct_command_regex(content) else: - s = r'{0}'.format(self.content) + s = r'{0}'.format(r'{}'.format('|'.join(content.split('\n')))) return s @classmethod def construct_command_regex(cls, content): regex = [] - content = content.replace('\r\n', '\n') for _cmd in content.split('\n'): cmd = re.sub(r'\s+', ' ', _cmd) cmd = re.escape(cmd)