You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Do you want to request a feature or report a bug?
I'd like to report a bug because this appears to me as undocumented and undesired behaviour,
but I understand that this could also be feature request.
What is the current behavior?
When POSTing a file containing non ASCII characters in it's name, using Content-Type: multipart/form-data
and Content-Disposition with defined encoding:
when accessing upload in POST handler like myFile.filename
I get file content instead of it's name.
If the current behavior is a bug, please provide the steps to reproduce and if possible a screenshots and logs of the problem.
import requests
fn = '/tmp/test_\xc5\x82\xc3\xb3\xc4\x85\xc3\xa4.po'
with open(fn, 'rb') as fh: r = requests.post(url, files={'myFile': fh})
What is the expected behavior?
I think that the best way would be to handle encoding and return name as unicode object
but if this isn't possible, perhaps return HTTP 400 Bad Request or at least throw NotImplementedError which would be returned as HTTP 500?
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, e.g. stackoverflow, gitter, etc.)
Do you want to request a feature or report a bug?
I'd like to report a bug because this appears to me as undocumented and undesired behaviour,
but I understand that this could also be feature request.
What is the current behavior?
When POSTing a file containing non ASCII characters in it's name, using Content-Type: multipart/form-data
and Content-Disposition with defined encoding:
form-data; name="myFile"; filename*=utf-8''upload_test_file_%C5%82%C3%B3%C4%85%C3%A4.txt
when accessing upload in POST handler like
myFile.filename
I get file content instead of it's name.
I think that the best way would be to handle encoding and return name as unicode object
but if this isn't possible, perhaps return HTTP 400 Bad Request or at least throw NotImplementedError which would be returned as HTTP 500?
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
https://tools.ietf.org/html/rfc5987
https://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http
The text was updated successfully, but these errors were encountered: