New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support parsing multiple files for one form field #2165
base: main
Are you sure you want to change the base?
Conversation
Doesn't Rack already support this if the name ends with Personally, the |
Yes but that's a Rails invention, not part of the spec.
What about when it's not possible to change the name of the field on the client side, or you need to support field names with and without the
Browsers, the multipart-post gem, and the cgi gem all support fields with the same name. For example:
It's also implemented that way in other languages. For example:
|
While it originally came from Rails, the behavior has been part of Rack for I think over 15 years.
The main advantage of the current behavior is that if you specify If we were going to support this behavior, it would have to be opt-in and off by default. Considering that the inability to control the client side parameter name is fairly rare, I'm not sure it is worth supporting at all. |
Then you don't want the [custom, built-atop-the-underlying-protocol] Rack nested params parsing algorithm; you want raw access to the parameters as supplied. That's something Rack provides at a couple of levels, including via |
Yes... I don't want the nested params parsing algorithm but that's what Would implementing something custom similar to |
This implements support for parsing multipart requests that contain multiple files with the same name.
From RFC7578 Section 4.3:
This isn't strictly backwards compatible because it affects
Rack::Utils.parse_nested_query
, however I would argue the existing behaviour there is a bug on the basis that a) it's not a feature to have data silently dropped/overwritten so not something many are likely to be relying upon, and b)parse_nested_query
doesn't currently match the behaviour ofparse_query
which does the correct thing:You can test out uploading multiple files from browsers using something like this: