diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 3e576d0c2..0065c36bc 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -27,6 +27,8 @@ poll_regex = re.compile("\s*\$\$([^\$\n]+)\$\$\s*", flags=re.A) bet_regex = re.compile("\s*\$\$\$([^\$\n]+)\$\$\$\s*", flags=re.A) choice_regex = re.compile("\s*&&([^\$\n]+)&&\s*", flags=re.A) +html_comment_regex = re.compile("", flags=re.A) + title_regex = re.compile("[^\w ]", flags=re.A) based_regex = re.compile("based and (.{1,20}?)(-| )pilled", flags=re.I|re.A) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index a77e54764..d4abcabcf 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -197,6 +197,7 @@ def sanitize_raw_title(sanitized): def sanitize_raw_body(sanitized, is_post): if not sanitized: return "" + sanitized = html_comment_regex.sub('', sanitized) sanitized = sanitized.replace('\u200e','').replace('\u200b','').replace("\ufeff", "").replace("\r\n", "\n") sanitized = sanitized.strip() return sanitized[:POST_BODY_LENGTH_LIMIT if is_post else COMMENT_BODY_LENGTH_LIMIT]