fileFilter is not returning with cb() until upload completes, even when rejected or error is thrown
- Dominant language
- JavaScript
- Stars
- 12.1k
- Forks
- 1.1k
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 21
Description
This issue was [brought up once before](https://github.com/expressjs/multer/issues/525) however it was closed because it was supposedly related to issue #344, but I don't believe that to be the case.
Here's the problem. I'm using `fileFilter` to attempt to validate files. If a file is not valid, I attempt to call `cb(null, false)` to reject the file or `cb(new Error('File not permitted.'))` to throw an error. Calling either of these doesn't seem to return control to the route's main function until the upload completes. Therefore, even though I know a file is not valid, the file continues to upload to 100% before server actually rejects it and informs the user.
Supposedly, this was related to using the [`limits` property problem](https://github.com/expressjs/multer/issues/344), however I've completely eliminated `limits` and I am still experiencing this issue.
Contributor guide
Assessment
This issue has not been assessed yet.