typestack/routing-controllers

fix: UploadedFile returns undefined value

mrdavidrees opened this issue · 2 comments

Description

I upgraded from 0.9.0 today to 0.10.1
Now the UploadedFile decorator is returning undefined.
The context clearly shows the file with the matching field name.

Minimal code-snippet showcasing the problem

export const fileUploadConfig = {
  options: {
    fileFilter: (
      req: any,
      file: Express.Multer.File,
      cb: (error: any | null, pass: boolean) => void,
    ) => {
      console.log(file);  //{fieldname: 'file', originalname: '...
      cb(null, true);
    },
  },
};

  @Post('/upload_file')
  async uploadFile(
    @Ctx() context: Context,
    @UploadedFile('file', fileUploadConfig) body: Express.Multer.File,
  ) {
    console.log(context.file) //{fieldname: 'file', originalname: '...
    console.log(body) //undefined
    return "this is broken";
  }

using recommended packages.
"@koa/multer": "3.0.2",
"multer": "1.4.4",

@typestack I got the same error at IdeaMall/data-service#14

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.