expressjs / expressjs/multer

Wrong error triggered when number of fields exceed maxCount with .array(fieldname[, maxCount])

Open
#402 3 comments 1 reaction 0 assignees View on GitHub
future
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

I use `upload.array('files', 5)`.

When I send from 1 to 5 files, everything works great !
But when I send 6 files I got the following error :
`{ [Error: Unexpected field] code: 'LIMIT_UNEXPECTED_FILE', field: 'files', storageErrors: [] }`

According to [make-error.js](https://github.com/expressjs/multer/blob/master/lib/make-error.js) I should get this code `LIMIT_FILE_COUNT` right ? Or am I missing something ?

Contributor guide

Open the contributing guide

Research direction

The report uses upload.array('files', 5) and points to lib/make-error.js. Reproduce the six-file upload, then trace how the array limit is handled and compare the emitted error with LIMIT_FILE_COUNT. Done means the six-file case reports the intended code and the existing behavior remains correct for one through five files.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.