diff --git a/files/helpers/const.py b/files/helpers/const.py index 0817d963a..fa4548a8f 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -816,4 +816,6 @@ yt_id_regex = re.compile('[a-z0-9-_]{5,20}', flags=re.I|re.A) image_regex = re.compile("(^|\s)(https:\/\/[\w\-.#&/=\?@%;+]{5,250}(\.png|\.jpg|\.jpeg|\.gif|\.webp|maxwidth=9999|fidelity=high))($|\s)", flags=re.I|re.A) -procoins_li = (0,2500,5000,10000,25000,50000,125000,250000) \ No newline at end of file +procoins_li = (0,2500,5000,10000,25000,50000,125000,250000) + +linefeeds_regex = re.compile("([^\n])\n([^\n])", flags=re.A) \ No newline at end of file diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index ae61e0ead..ff272c042 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -87,6 +87,8 @@ def sanitize(sanitized, alert=False, comment=False, edit=False): signal.signal(signal.SIGALRM, handler) signal.alarm(1) + sanitized = linefeeds_regex.sub(r'\1\n\n\2', sanitized) + sanitized = image_check_regex.sub(r'\1', sanitized) sanitized = markdown(sanitized)