Opened 4 years ago
Closed 4 years ago
#31787 closed Bug (needsinfo)
dumpdata/loaddata BinaryField base64 decoding fails
Reported by: | David | Owned by: | nobody |
---|---|---|---|
Component: | Core (Serialization) | Version: | 2.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Change History (1)
comment:1 by , 4 years ago
Component: | Uncategorized → Core (Serialization) |
---|---|
Resolution: | → needsinfo |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Thanks for this ticket, however I cannot reproduce this issue. Please provide a sample project.