diff --git a/files/helpers/const.py b/files/helpers/const.py
index c5a97dac2e..e050f228b8 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -763,8 +763,7 @@ mute_regex = re.compile("/mute @([a-z0-9_\-]{3,25}) ([0-9])+", flags=re.A)
emoji_regex = re.compile(f"[^a]>\s*(:[!#@]{{0,3}}[{valid_username_chars}]+:\s*)+<\/", flags=re.A)
emoji_regex2 = re.compile(f"(?([\w:~,()\-.#&\/=?@%;+]{5,250})<\/a>', flags=re.A)
diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py
index 989b6d809f..967a053cbd 100644
--- a/files/helpers/sanitize.py
+++ b/files/helpers/sanitize.py
@@ -105,17 +105,18 @@ def render_emoji(html, regexp, edit, marseys_used=set(), b=False):
emoji = emoji.replace('!','').replace('#','')
if emoji == 'marseyrandom': emoji = choice(marseys_const2)
+ emoji_partial_pat = '
'
emoji_partial = '
'
emoji_html = None
if emoji.endswith('pat'):
if path.isfile(f"files/assets/images/emojis/{emoji.replace('pat','')}.webp"):
attrs += ' pat'
- emoji_html = f'
{emoji_partial.format(old, f"/e/{emoji[:-3]}.webp", attrs)}'
+ emoji_html = f'
{emoji_partial_pat.format(old, f"/e/{emoji[:-3]}.webp", attrs)}'
elif emoji.startswith('@'):
if u := get_user(emoji[1:-3], graceful=True):
attrs += ' pat'
- emoji_html = f'
{emoji_partial.format(old, f"/pp/{u.id}", attrs)}'
+ emoji_html = f'
{emoji_partial_pat.format(old, f"/pp/{u.id}", attrs)}'
elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
emoji_html = emoji_partial.format(old, f'/e/{emoji}.webp', attrs)
@@ -206,10 +207,10 @@ def sanitize(sanitized, alert=False, comment=False, edit=False):
sanitized = sanitized.replace(old, new)
- emojis = list(emoji_regex3.finditer(sanitized))
+ emojis = list(emoji_regex2.finditer(sanitized))
if len(emojis) > 20: edit = True
- sanitized = render_emoji(sanitized, emoji_regex3, edit, marseys_used)
+ sanitized = render_emoji(sanitized, emoji_regex2, edit, marseys_used)
for rd in ["://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it", "://teddit.net"]:
sanitized = sanitized.replace(rd, "://old.reddit.com")
@@ -315,7 +316,7 @@ def filter_emojis_only(title, edit=False, graceful=False):
title = title.replace('','').replace('','').replace("\ufeff", "").replace("𒐪","").replace("\n", "").replace("\r", "").replace("\t", "").replace("&", "&").replace('<','<').replace('>','>').replace('"', '"').replace("'", "'").strip()
- title = render_emoji(title, emoji_regex4, edit)
+ title = render_emoji(title, emoji_regex3, edit)
title = strikethrough_regex.sub(r'\1', title)