Skip to content

Internal Server Error 500 on POST requests containing non-ASCII characters (multipart/form-data with a picture) #73

Closed
@patricks-dev

Description

@patricks-dev

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

What did you do?

Apply a slight modification to the example from README.md under Quickstart, so it would accept POST requests. Then start the test server and post a multipart/form-data including a picture, with curl:

curl -v -F filename=picture.jpg -F upload=@/full/path/to/picture.jpg http://localhost:8080

What did you expect to see?

"Hello World!"

What did you see instead?

*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.81.0
> Accept: */*
> Content-Length: 2175522
> Content-Type: multipart/form-data; boundary=------------------------c892a83a67802793
> Expect: 100-continue
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 100 Continue
* Mark bundle as not supporting multiuse
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 INTERNAL SERVER ERROR
< Server: Werkzeug/3.0.0 Python/3.10.12
< Date: Wed, 11 Oct 2023 09:11:02 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 21974
< Connection: close

[...]

ValueError: string argument should contain only ASCII characters // Werkzeug Debugger

[...]

Traceback:
File "/usr/lib/python3.10/base64.py", line 37, in _bytes_from_decode_data

[...]

During handling of the above exception, another exception occurred:
File "~/.local/lib/python3.10/site-packages/flask/app.py, line 2213, in __call__

[...]

The WSGI server calls the Flask application object as the WSGI application. This calls :meth:`wsgi_app`, which can be wrapped to apply middleware.

[...]

What version of Python are you using (python --version)?

Python 3.10.12

Does this issue reproduce with the latest release?

Yes

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions