make linking to link groups case insensitive

master
Aevann 2023-03-10 23:49:03 +02:00
parent 90e2fe8469
commit af620ac05e
2 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@ valid_username_chars = 'a-zA-Z0-9_\-'
valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$", flags=re.A)
mention_regex = re.compile('(^|\s|>)@([a-zA-Z0-9_\-]{1,30})(?!([^<]*<\/(code|pre|a)>|[^`]*`))', flags=re.A)
group_mention_regex = re.compile('(^|\s|>)!([a-z0-9_\-]{3,25})(?!([^<]*<\/(code|pre|a)>|[^`]*`))', flags=re.A)
group_mention_regex = re.compile('(^|\s|>)!([a-z0-9_\-]{3,25})(?!([^<]*<\/(code|pre|a)>|[^`]*`))', flags=re.A|re.I)
everyone_regex = re.compile('(^|\s|>)!(everyone)(?!([^<]*<\/(code|pre|a)>|[^`]*`))', flags=re.A)

View File

@ -391,7 +391,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys
else:
existing = g.db.get(Group, name)
if existing:
sanitized = sanitized.replace(i.group(0), f'{i.group(1)}<a href="/!{i.group(2)}">!{i.group(2)}</a>', 1)
sanitized = sanitized.replace(i.group(0), f'{i.group(1)}<a href="/!{name}">!{name}</a>', 1)
soup = BeautifulSoup(sanitized, 'lxml')