diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 557a976fe..c3eae2763 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -40,7 +40,7 @@ spoiler_regex = re.compile('''\|\|(.+)\|\|''', flags=re.A) reddit_regex = re.compile('(^|\s|
)\/?((r|u)\/(\w|-){3,25})(?![^<]*<\/(code|pre|a)>)', flags=re.A) sub_regex = re.compile('(^|\s|
)\/?(h\/(\w|-){3,25})(?![^<]*<\/(code|pre|a)>)', flags=re.A)
-strikethrough_regex = re.compile('''~{1,2}([^~]+)~{1,2}''', flags=re.A)
+strikethrough_regex = re.compile('(^|\s)~{1,2}([^~]+)~{1,2}', flags=re.A)
mute_regex = re.compile("/mute @([a-z0-9_\-]{3,25}) ([0-9])+", flags=re.A)
diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py
index 4c8f30147..84900255c 100644
--- a/files/helpers/sanitize.py
+++ b/files/helpers/sanitize.py
@@ -186,8 +186,6 @@ def sanitize(sanitized, edit=False):
sanitized = markdown(sanitized)
- sanitized = strikethrough_regex.sub(r'\1', sanitized)
-
sanitized = sanitized.replace('','').replace('','').replace("\ufeff", "").replace("𒐪","")
sanitized = reddit_regex.sub(r'\1/\2', sanitized)
@@ -377,7 +375,7 @@ def filter_emojis_only(title, edit=False, graceful=False):
marsey.count += 1
g.db.add(marsey)
- title = strikethrough_regex.sub(r'\1', title)
+ title = strikethrough_regex.sub(r'\1\2', title)
title = bleach.clean(title, tags=['img','del','span'], attributes=allowed_attributes_emojis, protocols=['http','https'])