From fef1a41dca04bff54013779b38e48315791c9a5e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 27 Mar 2022 16:34:56 +0200 Subject: [PATCH] gfd --- files/helpers/const.py | 3 ++- files/helpers/sanitize.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index da4af3140..1f8fd5246 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -714,7 +714,8 @@ email_regex = re.compile('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z| reddit_post_regex = re.compile('(https:\/\/old.reddit.com\/r\/\w{1,30}\/comments\/[a-z0-9]+).*', flags=re.A) -utm_regex = re.compile('utm_[a-z]+=[a-z0-9_]+&?"', flags=re.A) +utm_regex = re.compile('utm_[a-z]+=[a-z0-9_]+&', flags=re.A) +utm_regex2 = re.compile('[?&]utm_[a-z]+=[a-z0-9_]+', flags=re.A) slur_regex = re.compile(rf"((?<=\s|>)|^)({single_words})((?=[\s<,.$]|s[\s<,.$]))", flags=re.I|re.A) slur_regex_upper = re.compile(rf"((?<=\s|>)|^)({single_words.upper()})((?=[\s<,.$]|S[\s<,.$]))", flags=re.A) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 27dfeb597..07f7bdfbb 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -330,8 +330,10 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): sanitized = sanitized.replace('#fortune', '') sanitized += '\n\n

' + choice(FORTUNE_REPLIES) + '

' - sanitized = utm_regex.sub(sanitized) - + sanitized = sanitized.replace('&','&') + sanitized = utm_regex.sub('', sanitized) + sanitized = utm_regex2.sub('', sanitized) + signal.alarm(0) return sanitized