Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 9e7183073f64e541587e8dcfd8bb3ddeb47f8162 1 parent be10289
@claudep claudep authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  django/contrib/messages/storage/cookie.py
View
3  django/contrib/messages/storage/cookie.py
@@ -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:])
Please sign in to comment.
Something went wrong with that request. Please try again.