From d58351637cbf2ba75f08752053f13dcacc43473b Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 02:14:12 -0700 Subject: [PATCH] use constants --- files/helpers/actions.py | 4 ++-- files/routes/posts.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index b7b9f16ec..3fc6d3964 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -139,13 +139,13 @@ def execute_snappy(post, v): body += addition archive_url(href) - body = body.strip() + body = body.strip()[:POST_BODY_LENGTH_LIMIT] body_html = sanitize(body) if len(body_html) == 0: return - if len(body_html) < 40000: + if len(body_html) < POST_BODY_HTML_LENGTH_LIMIT: c = Comment(author_id=SNAPPY_ID, distinguish_level=6, parent_submission=post.id, diff --git a/files/routes/posts.py b/files/routes/posts.py index 40910bf07..25d8faae4 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -860,7 +860,7 @@ def submit_post(v, sub=None): body = body.replace(i.group(0), "") body += process_files() - body = body.strip() + body = body.strip()[:POST_BODY_LENGTH_LIMIT] # process_files() adds content to the body, so we need to re-strip torture = (v.agendaposter and not v.marseyawarded and sub != 'chudrama') @@ -869,7 +869,7 @@ def submit_post(v, sub=None): if v.marseyawarded and marseyaward_body_regex.search(body_html): return error("You can only type marseys!") - if len(body_html) > 40000: return error("Submission body_html too long! (max 40k characters)") + if len(body_html) > POST_BODY_HTML_LENGTH_LIMIT: return error(f"Submission body_html too long! (max {POST_BODY_HTML_LENGTH_LIMIT} characters)") club = False if FEATURES['COUNTRY_CLUB']: