mirror of
https://github.com/zulip/zulip.git
synced 2026-07-03 21:10:12 +08:00
Fix regression in whitespace stripping at the start of messages.
This fixes a regression in 4060a97656,
which incorrectly stripped whitespace at the start of messages as
well.
Fixes #3719.
This commit is contained in:
parent
d75a1b0bfc
commit
6ba1cd797b
@ -1249,7 +1249,7 @@ def check_message(sender, client, message_type_name, message_to,
|
||||
message_to = [sender.default_sending_stream.name]
|
||||
if len(message_to) == 0:
|
||||
raise JsonableError(_("Message must have recipients"))
|
||||
message_content = message_content_raw.strip()
|
||||
message_content = message_content_raw.rstrip()
|
||||
if len(message_content) == 0:
|
||||
raise JsonableError(_("Message must not be empty"))
|
||||
message_content = truncate_body(message_content)
|
||||
|
||||
@ -861,11 +861,11 @@ class MessagePOSTTest(ZulipTestCase):
|
||||
"""
|
||||
self.login("hamlet@zulip.com")
|
||||
post_data = {"type": "stream", "to": "Verona", "client": "test suite",
|
||||
"content": "I like whitespace at the end! \n\n \n", "subject": "Test subject"}
|
||||
"content": " I like whitespace at the end! \n\n \n", "subject": "Test subject"}
|
||||
result = self.client_post("/json/messages", post_data)
|
||||
self.assert_json_success(result)
|
||||
sent_message = self.get_last_message()
|
||||
self.assertEqual(sent_message.content, "I like whitespace at the end!")
|
||||
self.assertEqual(sent_message.content, " I like whitespace at the end!")
|
||||
|
||||
def test_long_message(self):
|
||||
# type: () -> None
|
||||
|
||||
Loading…
Reference in New Issue
Block a user