Skip to content

fix: reject non-scalar file entry fields before UploadedFile construction - #1121

Open
rootsiemen wants to merge 1 commit into
crazy-goat:masterfrom
rootsiemen:fix-20261027-nested-upload-types
Open

rootsiemen wants to merge 1 commit into
crazy-goat:masterfrom
rootsiemen:fix-20261027-nested-upload-types

Conversation

@rootsiemen

Copy link
Copy Markdown
Contributor

Closes #1111

Nested multipart fields (f[name][x], f[tmp_name][x], ...) make a file entry's leaves arrays instead of scalars. processFileEntry() only checked that the keys exist, so the array reached UploadedFile::__construct() and raised an uncaught TypeError (500) on client input. FileUploadValidator::assertFieldTypes() now checks the leaf types first (name/tmp_name/type strings, size/error ints) and throws FileUploadValidationException, which the handler classifies as a 400 client error.

Tests: testNestedFileFieldLeavesThrowFileUploadValidationException (the issue's nested-field shape) and testNonIntegerFileErrorFieldThrowsFileUploadValidationException (array in error, the smaller fuzz input from the issue).

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.

[Bug] Nested multipart file fields cause an uncaught TypeError in RequestConverter (500 instead of a client error)

1 participant