AssetManager: Configurable upload name suffix for multi file uploads #5672
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.
This PR adds the option
multiUploadSuffix
to theAssetManagerConfig
. This makes it possible to replace the currently hard-coded value[]
with a custom one or just an empty string.To ensure the change causes no breakage for existing setups, the value of
multiUploadSuffix
defaults to[]
. Developers who would like to have another or no suffix at all can change it to their needs.A related issue was raised already in #693, but closed with the argument, that the
name
property of aContent-Disposition
line represents an array. I know the brackets are common practice in PHP, where they are processed as an indicator for an array of uploaded files, so there is a valid case for the brackets being there. The reasoning for this patch is, that in ASP.NET there is an integrated type (IFormFileCollection
) that can receivemulti-part/form-data
-uploads. When using it, the file list is automatically mapped to the variable with a name that matchesname
property. This mechanism fails, because the variable name contains brackets.There is a workaround for ASP.NET, but that requires maintaining a "manual" extraction of the files from the incoming request or creating a middle ware. Using a framework provided method is less work, more reliable and secure. Especially because we're dealing with binary file uploads here.