Skip to content
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.
  • Loading branch information...
1 parent be10289 commit 9e7183073f64e541587e8dcfd8bb3ddeb47f8162 @claudep claudep committed
Showing with 3 additions and 0 deletions.
  1. +3 −0 django/contrib/messages/storage/
3 django/contrib/messages/storage/
@@ -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:])

0 comments on commit 9e71830

Please sign in to comment.
Something went wrong with that request. Please try again.