#22971: Can't receive file with non-ascii filename according to rfc2388
-------------------------------+--------------------
Reporter: homm | Owner: nobody
Type: Bug | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Requests, popular Python library, starting from version 2.0 sends files
with non-ascii characters in filename in full compliance with rfc2388:
The original local file name may be supplied as well, either as a
"filename" parameter either of the "content-disposition: form-data"
header or, in the case of multiple files, in a "content-disposition:
file" header of the subpart. The sending application MAY supply a
file name; if the file name of the sender's operating system is not
in US-ASCII, the file name might be approximated, or encoded using
the method of RFC 2231.
Where RFC 2231 defines attributes with * char. And requests uses such
attribute name to send non-ascii file names.
{{{
# requests 1.2.3
>>> requests.post('http://ya.ru', files={'file': (u'файл',
'123')}).request.body
--cb90e5c32429403b99966534716cda56
Content-Disposition: form-data; name="file"; filename="файл"
Content-Type: application/octet-stream
123
--cb90e5c32429403b99966534716cda56--
# requests 2.0
>>> requests.post('http://ya.ru', files={'file': (u'файл',
'123')}).request.body
--40f2f1873ec843598773fe150b4f783a
Content-Disposition: form-data; name="file";
filename*=utf-8''%D1%84%D0%B0%D0%B9%D0%BB
123
--40f2f1873ec843598773fe150b4f783a--
}}}
But Django doesn't recognize such files and puts raw files content in
`request.POST` instead of population `request.FILES`.
--
Ticket URL: <https://code.djangoproject.com/ticket/22971>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/047.7ace34c400c69e8071559a898be718b4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.