Repository navigation
Fix form mapping for file lists and dictionary keys containing brackets - #69782
MohamedHasan3644 wants to merge 7 commits into
Conversation
|
Thanks for your PR, @MohamedHasan3644. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
🟢 Approval recommended
The implementation addresses the reported binding failures with consistent behavior and comprehensive regression coverage.
0 open findings
What changed in this PR
Fixes form mapping for file collections and dictionary keys containing closing brackets.
Changes:
- Corrects prefix-aware file discovery and root file-list binding.
- Preserves embedded
]characters in dictionary keys. - Adds focused unit and endpoint regression coverage.
| File | Description |
|---|---|
RequestDelegateFactoryTests.FormMapping.cs |
Adds endpoint-level regression tests. |
RequestDelegateFactory.cs |
Applies root file-list parameter prefixes. |
BrowserFileFromFormFileTests.cs |
Tests unmatched browser-file lists. |
FormDataMapperTests.cs |
Covers file discovery and bracketed dictionary keys. |
FormDataReader.cs |
Identifies structural closing brackets. |
FileConverter.cs |
Makes file-list discovery prefix-aware. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
|
/review |
kotlarmilos
left a comment
There was a problem hiding this comment.
Please split the dictionary-key parsing change from the file-list fix. Silently binding the wrong key needs addressing, but we should first define whether embedded ] characters are supported or rejected, rather than introducing additional parsing heuristics here.
Description
Bug Description
[FromForm] IReadOnlyList<IFormFile>parameters did not respect the parameter name or an explicit[FromForm(Name = "...")]alias.]were truncated, preventing the submitted values from binding correctly.Description of Code Changes
IReadOnlyList<IFormFile>andIReadOnlyList<IBrowserFile>.IFormFileCollectionunder indexed paths so unrelated uploads do not keep collection probing active.IFormFileCollectionproperty.IReadOnlyList<IFormFile>.].Areas Covered
Validation
Endpoint Regression Tests
SupportsFormFileListInCollectionItemSupportsFormFileCollectionInCollectionItemSupportsRootFormFileListfilesand the explicit aliasdocs.SupportsDictionaryKeyContainingClosingBracketa=1, x]y=2.Both rows were verified independently:
Form-Mapping Unit Tests
Deserialize_Dictionary_KeyContainingClosingBracketx]y,x], andx]]y.Deserialize_Dictionary_KeyContainingClosingBracket_WithNestedDictionaryDeserialize_Dictionary_KeyContainingClosingBracket_WithComplexValueDeserialize_Dictionary_KeyContainingClosingBracket_WithCollectionValueCanDeserialize_ComplexType_IReadOnlyListFormFileWithNoMatches_IsNotFoundTryRead_IBrowserFileList_WithNoMatchingFiles_IsNotFoundfound = false.Existing parser expectations were updated for embedded brackets while retaining coverage for structural boundaries and malformed inputs.
Build and Test Results
Recorded local validation:
Output
Before
After
Fixes #69717