New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
werkzeug.test.stream_encode_multipart raises ValueError if the data contains empty stream #2740
Milestone
Comments
Happy to review a PR |
pandabear
pushed a commit
to pandabear/werkzeug
that referenced
this issue
Jun 28, 2023
pandabear
pushed a commit
to pandabear/werkzeug
that referenced
this issue
Jun 28, 2023
pandabear
pushed a commit
to pandabear/werkzeug
that referenced
this issue
Jun 28, 2023
pandabear
pushed a commit
to pandabear/werkzeug
that referenced
this issue
Jun 28, 2023
pandabear
pushed a commit
to pandabear/werkzeug
that referenced
this issue
Jun 28, 2023
pandabear
pushed a commit
to pandabear/werkzeug
that referenced
this issue
Jun 28, 2023
pandabear
pushed a commit
to pandabear/werkzeug
that referenced
this issue
Jun 28, 2023
PR created here: #2742 ! |
benmwebb
added a commit
to salilab/multifoxs
that referenced
this issue
Jul 27, 2023
Current werkzeug fails if given an empty file as input; hold at 2.2 for now. See also pallets/werkzeug#2740.
benmwebb
added a commit
to salilab/foxsdock
that referenced
this issue
Jul 27, 2023
Current werkzeug fails if given an empty file as input; hold at 2.2 for now. See also pallets/werkzeug#2740.
benmwebb
added a commit
to salilab/multifit-web
that referenced
this issue
Jul 27, 2023
Current werkzeug fails if given an empty file as input; hold at 2.2 for now. See also pallets/werkzeug#2740.
6 tasks
Closed by #2765. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This was discovered in tests pipeline upon upgrading to latest Flask and during pytest run.
FlaskClient
was used to upload an empty bytes file with something likeIt will trigger a ValueError with the following stack trace:
I would've expected that an empty file could've been uploaded as multipart just fine.
Upon further examination, the cause seem to be this line:
werkzeug/src/werkzeug/test.py
Lines 135 to 141 in 82b5ac4
encoder
's state never gets updated fromState.DATA_START
, since thechunk
always returnsFalsey
and thus never gets to conduct the necessaryencoder.send_event
-call.So importing
from .sansio.multipart import State
and the modifying the lineif not chunk:
->if not chunk and encoder.state != State.DATA_START:
seemed to have solved this.Environment:
The text was updated successfully, but these errors were encountered: