[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
When two FilesInterceptor
s (multiple files!) are defined within one controller, only the last configuration options are applied. So when for the two endpoints two different fields are defined with @UseInterceptors(FilesInterceptor('first'))
and @UseInterceptors(FilesInterceptor('second'))
, both will only accept second
. It also doesn't work for a MulterOptions
object like
@UseInterceptors(FilesInterceptor('first', null, {
dest: './uploads/first'
}))
It does work however for FileInterceptor
s (single file!) or when two different Controller
are defined.
The given configuration should be applied.
Create a Controller with those two endpoints:
@Post('first')
@UseInterceptors(FilesInterceptor('first'))
async uploadFirst(@UploadedFiles() files) {
return files;
}
@Post('second')
@UseInterceptors(FilesInterceptor('second'))
async uploadSecond(@UploadedFiles() files) {
return files;
}
Make the following form-data POST requests to the given endpoint with a file in the given field:
| Endpoint | Field | Result | Expected |
| --- | --- | --- | --- |
| first
| first
| 400 - Unexpected field
| Should work ❌ |
| first
| second
| 200
| Should not work ❌ |
| second
| second
| 200
| Should work ✔️ |
It might be the other way around: first works, second doesn't.
Came up in this Stackoverflow question.
Nest version: 5.1.2
For Tooling issues:
- Node version: v8.10.0
- Platform: Windows
Others:
Fixed in v5.2.0
. Will publish soon
5.2.0 is published!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Fixed in
v5.2.0
. Will publish soon