Skip to content

Fix empty multipart body form fields#1735

Open
cyphercodes wants to merge 1 commit into
vitalik:masterfrom
cyphercodes:fix-empty-multipart-body-field
Open

Fix empty multipart body form fields#1735
cyphercodes wants to merge 1 commit into
vitalik:masterfrom
cyphercodes:fix-empty-multipart-body-field

Conversation

@cyphercodes

Copy link
Copy Markdown

Summary

  • Avoid indexing multipart body form data when a submitted string field is empty.
  • Preserve the existing quote-wrapping behavior while allowing empty strings to parse as JSON string bodies.
  • Add regression coverage for a multipart request with a Body string field and file upload.

Tests

  • pytest -q tests/test_forms_and_files.py tests/test_params_models.py
  • ruff format --check ninja tests
  • ruff check ninja tests
  • git diff --check

Fixes #1703

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_MultiPartBodyModel raises IndexError on empty form fields

1 participant