Commit 9e718307 authored by Claude Paroz's avatar Claude Paroz
Browse files

[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.
parent be10289d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -33,6 +33,9 @@ class MessageDecoder(json.JSONDecoder):
    def process_messages(self, obj):
        if isinstance(obj, list) and obj:
            if obj[0] == MessageEncoder.message_key:
                if len(obj) == 3:
                    # Compatibility with previously-encoded messages
                    return Message(*obj[1:])
                if obj[1]:
                    obj[3] = mark_safe(obj[3])
                return Message(*obj[2:])