rwe
This commit is contained in:
parent
f55625444c
commit
fea59c1efb
2 changed files with 4 additions and 0 deletions
|
@ -714,6 +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)
|
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)
|
||||||
|
|
||||||
slur_regex = re.compile(rf"((?<=\s|>)|^)({single_words})((?=[\s<,.$]|s[\s<,.$]))", flags=re.I|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)
|
slur_regex_upper = re.compile(rf"((?<=\s|>)|^)({single_words.upper()})((?=[\s<,.$]|S[\s<,.$]))", flags=re.A)
|
||||||
torture_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A)
|
torture_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A)
|
||||||
|
|
|
@ -330,6 +330,8 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
||||||
sanitized = sanitized.replace('#fortune', '')
|
sanitized = sanitized.replace('#fortune', '')
|
||||||
sanitized += '\n\n<p>' + choice(FORTUNE_REPLIES) + '</p>'
|
sanitized += '\n\n<p>' + choice(FORTUNE_REPLIES) + '</p>'
|
||||||
|
|
||||||
|
sanitized = utm_regex.sub(sanitized)
|
||||||
|
|
||||||
signal.alarm(0)
|
signal.alarm(0)
|
||||||
|
|
||||||
return sanitized
|
return sanitized
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue