XML escape body of sqs message body prior to encoding to XML
This commit is contained in:
parent
832e903f26
commit
ff27ef9e91
@ -3,6 +3,7 @@ import base64
|
|||||||
import hashlib
|
import hashlib
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
|
from xml.sax.saxutils import escape
|
||||||
|
|
||||||
|
|
||||||
from moto.core import BaseBackend
|
from moto.core import BaseBackend
|
||||||
@ -19,7 +20,7 @@ DEFAULT_ACCOUNT_ID = 123456789012
|
|||||||
class Message(object):
|
class Message(object):
|
||||||
def __init__(self, message_id, body):
|
def __init__(self, message_id, body):
|
||||||
self.id = message_id
|
self.id = message_id
|
||||||
self.body = body
|
self._body = body
|
||||||
self.message_attributes = {}
|
self.message_attributes = {}
|
||||||
self.receipt_handle = None
|
self.receipt_handle = None
|
||||||
self.sender_id = DEFAULT_ACCOUNT_ID
|
self.sender_id = DEFAULT_ACCOUNT_ID
|
||||||
@ -35,6 +36,10 @@ class Message(object):
|
|||||||
body_md5.update(self.body.encode('utf-8'))
|
body_md5.update(self.body.encode('utf-8'))
|
||||||
return body_md5.hexdigest()
|
return body_md5.hexdigest()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def body(self):
|
||||||
|
return escape(self._body)
|
||||||
|
|
||||||
def mark_sent(self, delay_seconds=None):
|
def mark_sent(self, delay_seconds=None):
|
||||||
self.sent_timestamp = unix_time_millis()
|
self.sent_timestamp = unix_time_millis()
|
||||||
if delay_seconds:
|
if delay_seconds:
|
||||||
|
Loading…
Reference in New Issue
Block a user