routing-controllers
routing-controllers copied to clipboard
Express.Multer.File[] usage triggering bug in action param validation logic
Even the most basic example of uploading multiple files does not work. It results in an error: Invalid files, check 'error' property for more info.
This is because the validation logic for action parameters for routing-controllers is triggering when the parameter is an array.
There's some logic that says the param should be validated if it's not an object. Obviously Express.Multer.Files[] is an array and not an object so it's being incorrectly triggered (see screenshot below, line 262 along with values from debugger).
@Post()
public async post(@UploadedFiles(`files`) bundleFiles: Express.Multer.File[]): Promise<void>
{
console.log(`BundleFiles`);
console.log(bundleFiles);
}
Hope this helps.
I'm using:
@JamesMcFall Is this still relevant? Could you try the latest version?