[1.5.x] Added compatibility with legacy message length
Added compatibility code to not break when decoding messages encoded on pre-1.5 versions. Refs #19387. Thanks Florian Apolloner for noticing the issue.
This commit is contained in:
parent
be10289d03
commit
9e7183073f
|
@ -33,6 +33,9 @@ class MessageDecoder(json.JSONDecoder):
|
||||||
def process_messages(self, obj):
|
def process_messages(self, obj):
|
||||||
if isinstance(obj, list) and obj:
|
if isinstance(obj, list) and obj:
|
||||||
if obj[0] == MessageEncoder.message_key:
|
if obj[0] == MessageEncoder.message_key:
|
||||||
|
if len(obj) == 3:
|
||||||
|
# Compatibility with previously-encoded messages
|
||||||
|
return Message(*obj[1:])
|
||||||
if obj[1]:
|
if obj[1]:
|
||||||
obj[3] = mark_safe(obj[3])
|
obj[3] = mark_safe(obj[3])
|
||||||
return Message(*obj[2:])
|
return Message(*obj[2:])
|
||||||
|
|
Loading…
Reference in New Issue