{{{
f.content_type = Image.MIME[image.format]
}}}
file is validated properly (opened, validated) and at the and, it's
mime_type is detected by using a dictionary `Image.MIME`.
This dictionary is not documented and does not contain entries for BMP
file, so it may be assumed that Django is using it's private api.
There are two options - push on Pillow to make this public API and fix an
issue or use different method to find mime-type (e.g. python's standard
mimetypes library)
--
Ticket URL: <https://code.djangoproject.com/ticket/24948>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_docs: => 0
* severity: Normal => Release blocker
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
It's a regression in 1.8 (#10935), so qualifies for a backport. At least
we could
[https://github.com/django/django/blob/9f825b9e28547b1310526c9be9fca9e6dbcd57e7/django/forms/fields.py#L686
catch the exception] and set `f.content_type = None` in that case.
--
Ticket URL: <https://code.djangoproject.com/ticket/24948#comment:1>
* status: new => assigned
* owner: nobody => coldmind
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/4869
I think setting `content_type` to None will be enough.
--
Ticket URL: <https://code.djangoproject.com/ticket/24948#comment:2>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/24948#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"cf6ce279c7671a4c83c960c5c526f92679a4fac8" cf6ce279]:
{{{
#!CommitTicketReference repository=""
revision="cf6ce279c7671a4c83c960c5c526f92679a4fac8"
Fixed #24948 -- Fixed crash when uploading bitmap images in
forms.ImageField
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24948#comment:4>
Comment (by Tim Graham <timograham@…>):
In [changeset:"8abe2d0643a9ad9986e5b12644dbe0d0fc8b5f5d" 8abe2d0]:
{{{
#!CommitTicketReference repository=""
revision="8abe2d0643a9ad9986e5b12644dbe0d0fc8b5f5d"
[1.8.x] Fixed #24948 -- Fixed crash when uploading bitmap images in
forms.ImageField
Backport of cf6ce279c7671a4c83c960c5c526f92679a4fac8 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24948#comment:5>