Validate file upload selections
Validate serializable file metadata against count, size, type, extension, and aggregate limits.Description
Requirements
The solution exports the required validateFileSelection API from the editable module.
Count limit works deterministically for the documented normal, boundary, and repeated-use scenarios.
Size limit works deterministically for the documented normal, boundary, and repeated-use scenarios.
Mime types works deterministically for the documented normal, boundary, and repeated-use scenarios.
Extension consistency works deterministically for the documented normal, boundary, and repeated-use scenarios.
Aggregate size works deterministically for the documented normal, boundary, and repeated-use scenarios.
Stable errors works deterministically for the documented normal, boundary, and repeated-use scenarios.
Caller-owned inputs and nested values remain unchanged after the operation completes.
Oversized selection
One 6 MB PNG with a 5 MB per-file limit
valid false with one size-limit error for that file
Stable errors can be rendered next to the corresponding browser selection without relying on File objects in tests.
Constraints
File records contain name, size, and typeReturn all applicable errors in documented orderDo not mutate or sort the caller's arrays
Hints
Hint 1
Validate collection-wide rules separately from per-file rules.
Hint 2
Normalize extensions and MIME types before comparing them.
Hint 3
Build errors in one fixed phase order so repeated calls return identical arrays.