Skip to content

fix(upload): align FilePond multipart field name with the endpoint#33

Merged
bigin merged 1 commit into
imanager-2.0from
fix/filepond-field-name
May 3, 2026
Merged

fix(upload): align FilePond multipart field name with the endpoint#33
bigin merged 1 commit into
imanager-2.0from
fix/filepond-field-name

Conversation

@bigin
Copy link
Copy Markdown
Owner

@bigin bigin commented May 3, 2026

Summary

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 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.

Test plan

  • POST -F filepond=@… → 200 (was 400)
  • POST -F file=@… → 200 (cURL convention still works)
  • POST without file → 400 with the new message
  • Browser: drag-drop in editor → 200 (replaces the 400)

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
@bigin bigin merged commit 40fc551 into imanager-2.0 May 3, 2026
@bigin bigin deleted the fix/filepond-field-name branch May 15, 2026 05:23
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.

1 participant