#35384: Assigning a file without a name property to a FileField results in file
getting discarded silently
-------------------------------------+-------------------------------------
Reporter: john- | Owner: nobody
parton |
Type: Bug | Status: new
Component: Database | Version: 5.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If you assign a File object without a name (A ContentFile or otherwise) to
an instance and then save it, the storage backend is not invoked, the data
isn't persisted, and the column isn't updated. All without raising an
error or even a logger message.
We've isolated the behavior here:
https://github.com/john-parton/django-
file-field-no-
name/blob/dc557c641552b02623f50ef044d73435b9e97ead/test_app/tests.py#L28-L41
There's some discussion here:
https://forum.djangoproject.com/t/setting-
filefield-imagefield-where-file-has-no-name/30192/24
The general consensus is that some error should be raised.
I'll see if I can submit a patch. I flagged this as Database layer,
because the patch will likely be in models.files, not the storage backend.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35384>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.