diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 75c84a820..642c4fd41 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -94,6 +94,7 @@ reddit_domain_regex = re.compile("(^|\s)https:\/\/(reddit\.com|new\.reddit.com|w color_regex = re.compile("[a-z0-9]{6}", flags=re.A) +showmore_regex = re.compile("(.{3000,40000}?
)(.*)", flags=re.A) def sub_matcher(match, upper=False): if match.group(0).startswith('<'): diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 92b573468..d0e3748c5 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -335,10 +335,14 @@ def sanitize(sanitized, edit=False): if bans: abort(403, description=f"Remove the banned domains {bans} and try again!") + sanitized = sanitized.replace('\n','') + + if len(sanitized) > 5000: + sanitized = showmore_regex.sub(r'\1