diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index 5dc25cd91d..7af31a2f02 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -606,7 +606,7 @@ def POST_BODY_LENGTH_LIMIT(v): POST_BODY_HTML_LENGTH_LIMIT = 200000 # do not make larger than 200000 without altering the table COMMENT_BODY_LENGTH_LIMIT = 10000 # do not make larger than 10000 characters without altering the table -COMMENT_BODY_HTML_LENGTH_LIMIT = 20000 # do not make larger than 20000 characters without altering the table +COMMENT_BODY_HTML_LENGTH_LIMIT = 40000 # do not make larger than 20000 characters without altering the table CSS_LENGTH_LIMIT = 10000 # do not make larger than 20000 characters without altering the table COMMENT_MAX_DEPTH = 200 TRANSFER_MESSAGE_LENGTH_LIMIT = 200 # do not make larger than 10000 characters (comment limit) without altering the table diff --git a/files/routes/comments.py b/files/routes/comments.py index 3b7c6b61fe..2073520550 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -256,7 +256,8 @@ def comment(v:User): if v.marseyawarded and posting_to_submission and post_target.id not in ADMIGGER_THREADS and marseyaward_body_regex.search(body_html): abort(403, "You can only type marseys!") - if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT: abort(400) + if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT: + abort(400, "Comment too long!") is_bot = v.client is not None and v.id not in PRIVILEGED_USER_BOTS diff --git a/files/routes/users.py b/files/routes/users.py index 2977d0b8dc..ebf0a66bee 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -598,10 +598,15 @@ def messagereply(v:User): body = process_dm_images(v, user, body) + body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT] + if not body: abort(400, "Message is empty!") body_html = sanitize(body) + if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT: + abort(400, "Message too long!") + if parent.sentto == MODMAIL_ID: sentto = MODMAIL_ID else: