Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
markdown: Increase max rendered message length to 1MB.
Wesley Aptekar-Casselsd5ba94082a2f
diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.pyindex 69c9b99241f..a50b0639e1a 100644--- a/zerver/lib/markdown/__init__.py+++ b/zerver/lib/markdown/__init__.py@@ -2612,9 +2612,9 @@ def do_convert(# rest of the codebase from any bugs where we end up rendering# something huge.MAX_MESSAGE_LENGTH = settings.MAX_MESSAGE_LENGTH- if len(rendered_content) > MAX_MESSAGE_LENGTH * 10:+ if len(rendered_content) > MAX_MESSAGE_LENGTH * 100:raise MarkdownRenderingException(- f"Rendered content exceeds {MAX_MESSAGE_LENGTH * 10} characters (message {logging_message_id})"+ f"Rendered content exceeds {MAX_MESSAGE_LENGTH * 100} characters (message {logging_message_id})")return rendered_contentexcept Exception:diff --git a/zerver/tests/test_markdown.py b/zerver/tests/test_markdown.pyindex edff75c04fb..3230bfb4975 100644--- a/zerver/tests/test_markdown.py+++ b/zerver/tests/test_markdown.py@@ -2749,9 +2749,9 @@ class MarkdownErrorTests(ZulipTestCase):@override_settings(MAX_MESSAGE_LENGTH=10)def test_ultra_long_rendering(self) -> None:- """A rendered message with an ultra-long length (> 10 * MAX_MESSAGE_LENGTH)+ """A rendered message with an ultra-long length (> 100 * MAX_MESSAGE_LENGTH)throws an exception"""- msg = "mock rendered message\n" * settings.MAX_MESSAGE_LENGTH+ msg = "mock rendered message\n" * 10 * settings.MAX_MESSAGE_LENGTHwith mock.patch("zerver.lib.markdown.timeout", return_value=msg), mock.patch("zerver.lib.markdown.markdown_logger"