fix underscores inside links

pull/102/head
Aevann 2023-01-27 11:11:13 +02:00
parent 21dd678c2d
commit df132627e6
4 changed files with 8 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import random
import re
import regex
from random import choice, choices
from typing import List, Optional, Union
@ -193,3 +194,5 @@ def command_regex_matcher(match, upper=False):
reason_regex = re.compile('(/(post|comment)/[0-9]+)', flags=re.A)
discord_username_regex = re.compile("(\s|^|>).{2,32}#[0-9]{4}(?=[^0-9]|$)", flags=re.A)
underscore_in_link_regex = regex.compile("(?<=https:\/\/[^\s)]+)_", flags=regex.A)

View File

@ -291,7 +291,10 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys
if FEATURES['MARKUP_COMMANDS']:
sanitized = command_regex.sub(command_regex_matcher, sanitized)
sanitized = underscore_in_link_regex.sub(r'\_', sanitized)
sanitized = markdown(sanitized)
sanitized = strikethrough_regex.sub(r'\1<del>\2</del>', sanitized)
# replacing zero width characters, overlines, fake colons

View File

@ -0,0 +1 @@
pip3 install regex

View File

@ -23,6 +23,7 @@ pyotp
pywebpush
qrcode
redis
regex
requests
SQLAlchemy
tinycss2