Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions backend/apps/owasp/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

import itertools
import logging
import re
from urllib.parse import urlparse
Expand Down Expand Up @@ -198,17 +197,22 @@ def get_leaders(self):

leaders = []
for line in content.split("\n"):
leaders.extend(
[
name
for name in itertools.chain(
*re.findall(
r"[-*]\s*\[\s*([^(]+?)\s*(?:\([^)]*\))?\]|\*\s*([\w\s]+)", line.strip()
)
)
if name.strip()
]
)
stripped = line.strip()

# Try bracket-style first: - [Name] or * [Name (Role)]
bracket_matches = re.findall(r"[-*]\s*\[\s*([^(\]]+)", stripped)
if bracket_matches:
name = bracket_matches[0].strip()
if name:
leaders.append(name)
continue

# Try plain asterisk-style: * Name (words separated by spaces)
plain_matches = re.findall(r"^\*\s+(\w+(?:\s+\w+)*)$", stripped)
if plain_matches:
name = plain_matches[0].strip()
if name:
leaders.append(name)

return leaders

Expand Down