diff --git a/zephyr/lib/actions.py b/zephyr/lib/actions.py index b1aa7abef5..715543b8f1 100644 --- a/zephyr/lib/actions.py +++ b/zephyr/lib/actions.py @@ -965,6 +965,8 @@ def do_update_message(user_profile, message_id, subject, content): first_rendered_content = old_edit_history_event['prev_rendered_content'] if content is not None: + if len(content) > MAX_MESSAGE_LENGTH: + raise JsonableError("Message too long") rendered_content = bugdown.convert(content, message.sender.realm.domain) if rendered_content is None: raise JsonableError("We were unable to render your updated message") @@ -985,6 +987,8 @@ def do_update_message(user_profile, message_id, subject, content): event["rendered_content"] = rendered_content if subject is not None: + if len(subject) > MAX_SUBJECT_LENGTH: + raise JsonableError("Subject too long") event["orig_subject"] = message.subject message.subject = subject event["subject"] = subject