escape windows return character (#4729)

This commit is contained in:
Cristopher Pinzón 2021-12-30 05:54:15 -05:00 committed by GitHub
parent a9293d62e3
commit b7f0dee4a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -150,7 +150,7 @@ class Message(BaseModel):
@property
def body(self):
return escape(self._body)
return escape(self._body).replace('"', """).replace("\r", "
")
def mark_sent(self, delay_seconds=None):
self.sent_timestamp = int(unix_time_millis())

View File

@ -3455,3 +3455,16 @@ def test_receive_message_again_preserves_attributes():
assert len(second_messages[0]["MessageAttributes"]) == 2
assert second_messages[0]["MessageAttributes"].get("Custom1") is not None
assert second_messages[0]["MessageAttributes"].get("Custom2") is not None
@mock_sqs
def test_message_has_windows_return():
sqs = boto3.resource("sqs", region_name="us-east-1")
queue = sqs.create_queue(QueueName=f"{str(uuid4())[0:6]}")
message = "content:\rmessage_with line"
queue.send_message(MessageBody=message)
messages = queue.receive_messages()
messages.should.have.length_of(1)
messages[0].body.should.match(message)