Opened 4 years ago
Last modified 4 years ago
#32643 closed Bug
CookieStorage for contrib.messages crashes after upgrade to django 3.2 — at Initial Version
Reported by: | Jan Pieter Waagmeester | Owned by: | nobody |
---|---|---|---|
Component: | contrib.messages | Version: | 3.2 |
Severity: | Release blocker | Keywords: | |
Cc: | Florian Apolloner | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
After upgrading to django 3.2, a prevously stored cookie for contrib.messages crashes in
Django Version: 3.2
Python Version: 3.8.2
Traceback (most recent call last): File "/home/obs/virtualenv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/home/obs/virtualenv/lib/python3.8/site-packages/django/utils/deprecation.py", line 119, in __call__ response = self.process_response(request, response) File "/home/obs/virtualenv/lib/python3.8/site-packages/django/contrib/messages/middleware.py", line 23, in process_response unstored_messages = request._messages.update(response) File "/home/obs/virtualenv/lib/python3.8/site-packages/django/contrib/messages/storage/base.py", line 127, in update messages = self._loaded_messages + self._queued_messages File "/home/obs/virtualenv/lib/python3.8/site-packages/django/contrib/messages/storage/base.py", line 79, in _loaded_messages messages, all_retrieved = self._get() File "/home/obs/virtualenv/lib/python3.8/site-packages/django/contrib/messages/storage/fallback.py", line 25, in _get messages, all_retrieved = storage._get() File "/home/obs/virtualenv/lib/python3.8/site-packages/django/contrib/messages/storage/cookie.py", line 86, in _get messages = self._decode(data) File "/home/obs/virtualenv/lib/python3.8/site-packages/django/contrib/messages/storage/cookie.py", line 175, in _decode return self.signer.unsign_object(data, serializer=MessageSerializer) File "/home/obs/virtualenv/lib/python3.8/site-packages/django/core/signing.py", line 195, in unsign_object data = b64_decode(base64d) File "/home/obs/virtualenv/lib/python3.8/site-packages/django/core/signing.py", line 68, in b64_decode return base64.urlsafe_b64decode(s + pad) File "/usr/lib/python3.8/base64.py", line 133, in urlsafe_b64decode return b64decode(s) File "/usr/lib/python3.8/base64.py", line 87, in b64decode return binascii.a2b_base64(s) Exception Type: Error at /user/login/ Exception Value: Invalid base64-encoded string: number of data characters (369) cannot be 1 more than a multiple of 4
(redacted) contents of the 'messages' cookie:
'[["__json_message",0,25,"Successfully signed in as ' 'admin@example.org."],["__json_message",0,25,"Successfully ' 'signed in as jieter."],["__json_message",0,25,"Ingelogd als ' 'admin@example.org."],["__json_message",0,25,"Ingelogd ' 'als ' 'admin@example.org."],["__json_message",0,20,"Bevestigingsmail ' 'verzonden naar test@example.nl."],["__json_message",0,25,"Ingelogd ' 'als ' 'test@example.nl."]]:1lTkj1:j_3PlpYSKiqPTMAB6_p2Q00eE8j6k7n0Sg_-_IpXG7Y')
Note:
See TracTickets
for help on using tickets.