fix(upload): align FilePond multipart field name with the endpoint#33
Merged
Conversation
FilePond's default multipart field name is `filepond`. The endpoint
shipped in 14d-1 only looked for `file`, so every browser upload
through the FilePond widget came back as
HTTP 400 "No \`file\` field on the upload" — even though the cURL
smoke (which uses `-F file=@…`) kept passing.
Two-sided fix:
- filepond-init.js sets `name: 'file'` on the FilePond.create()
options, so future client-side changes can't drift again.
- UploadEndpoint::handlePost() reads `file` first and falls back to
`filepond` so existing FilePond clients without the explicit name
config (3rd-party themes, older builds) keep working too.
- 400 message updated to "Upload missing `file` (or `filepond`)
field" — clearer hint about which keys are accepted.
Manual smoke (PHP built-in server, 50×50 PNG fixture):
POST -F filepond=@… → 200 (was 400)
POST -F file=@… → 200 (cURL convention still works)
POST without file → 400 with the new message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FilePond's default multipart field name is
filepond. The endpointshipped in 14d-1 only looked for
file, so every browser upload throughthe FilePond widget came back as HTTP 400 "No
filefield on theupload" — even though the cURL smoke (which uses
-F file=@…) keptpassing.
Two-sided fix:
filepond-init.jssetsname: 'file'onFilePond.create()options,so future client-side changes can't drift again.
UploadEndpoint::handlePost()readsfilefirst and falls back tofilepondso existing FilePond clients without the explicit nameconfig (3rd-party themes, older builds) keep working too.
file(orfilepond) field"— clearer hint about which keys are accepted.
Test plan
-F filepond=@…→ 200 (was 400)-F file=@…→ 200 (cURL convention still works)