[Django] #31787: dumpdata/loaddata BinaryField base64 decoding fails

10 views
Skip to first unread message

Django

unread,
Jul 14, 2020, 2:35:26 AM7/14/20
to django-...@googlegroups.com
#31787: dumpdata/loaddata BinaryField base64 decoding fails
-----------------------------------------+------------------------
Reporter: David | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
Exporting a model with a `BinaryField` via `dumpdata` fails to reimport
via `loaddata` returning an `Incorrect padding` error. The same error
occurs with either json or xml formatted data. In the application, I can
b64 encode the field data and copy it elsewhere just fine, but there seems
to be an issue with the builtin serializer/deserializer is doing the same.
There doesn't seem to be a note anywhere about this being expected
behaviour so thought this was worth a ticket.

Stacktrace:
{{{
Traceback (most recent call last):
File "../manage.py", line 21, in <module>
main()
File "../manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/user/.env/app/local/lib/python3.6/site-
packages/django/core/management/__init__.py", line 381, in
execute_from_command_line
utility.execute()
File "/home/user/.env/app/local/lib/python3.6/site-
packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/user/.env/app/local/lib/python3.6/site-
packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/user/.env/app/local/lib/python3.6/site-
packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/home/user/.env/app/local/lib/python3.6/site-
packages/django/core/management/commands/loaddata.py", line 72, in handle
self.loaddata(fixture_labels)
File "/home/user/.env/app/local/lib/python3.6/site-
packages/django/core/management/commands/loaddata.py", line 114, in
loaddata
self.load_label(fixture_label)
File "/home/user/.env/app/local/lib/python3.6/site-
packages/django/core/management/commands/loaddata.py", line 172, in
load_label
for obj in objects:
File "/home/user/.env/app/local/lib/python3.6/site-
packages/django/core/serializers/xml_serializer.py", line 168, in __next__
return self._handle_object(node)
File "/home/user/.env/app/local/lib/python3.6/site-
packages/django/core/serializers/xml_serializer.py", line 230, in
_handle_object
value = field.to_python(getInnerText(field_node).strip())
File "/home/user/.env/app/local/lib/python3.6/site-
packages/django/db/models/fields/__init__.py", line 2306, in to_python
return memoryview(b64decode(value.encode('ascii')))
File "/home/user/.env/app/lib64/python3.6/base64.py", line 87, in
b64decode
return binascii.a2b_base64(s)
binascii.Error: Problem installing fixture '/var/www/site-
app/services/dump.xml': Incorrect padding
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31787>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 14, 2020, 6:10:34 AM7/14/20
to django-...@googlegroups.com
#31787: dumpdata/loaddata BinaryField base64 decoding fails
-------------------------------------+-------------------------------------
Reporter: David | Owner: nobody
Type: Bug | Status: closed
Component: Core | Version: 2.2
(Serialization) |
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => needsinfo
* component: Uncategorized => Core (Serialization)


Comment:

Thanks for this ticket, however I cannot reproduce this issue. Please
provide a sample project.

--
Ticket URL: <https://code.djangoproject.com/ticket/31787#comment:1>

Reply all
Reply to author
Forward
0 new messages