From 50121f6960e38fdf99b1959841850fa06cb5a3ac Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 28 Jun 2022 07:41:21 +0200 Subject: [PATCH] fixed strikethrough --- files/helpers/regex.py | 2 +- files/helpers/sanitize.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) 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'])