fix(file_input): append [] to the name for multiple-file inputs - #23
Merged
Conversation
Rails file_field parity: without the [] suffix the browser collapses a multi-file selection into ONE scalar param, which a host app's params.expect(attr: []) silently discards — uploads no-op with a success response (bit cosmos yoga in production, Aug 2026). Applies to the standalone component, the Plain variant, and the form builder path; names already ending in [] are left alone.
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
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
Rails
file_fieldparity: withmultiple:set, the input name now gets[]appended (unless already present) — for the standalone component, thePlainvariant, and the form builder path.Without it, the browser collapses a multi-file selection into one scalar param, which a host app's
params.expect(attr: [])silently discards — uploads no-op while the request returns success. This bit cosmos/yoga in production (zoolutions/cosmos#1997): the Sardinia gallery upload 302'd "updated successfully" having attached nothing.Test plan
spec/forms/file_input_spec.rb: single name untouched,[]appended when multiple, no double-append, builder path, Plain variantSummary by cubic
Fix multiple file uploads by appending [] to the input name when multiple is set, matching Rails file_field behavior. Prevents browsers from collapsing multi-file selections into a single param so apps receive an array.
Plainvariant, and form builder.Written for commit 2607d0b. Summary will update on new commits.