Skip to content

4.20.4: File upload is empty and request body is '[object object]' #19735

@gregg-cbs

Description

@gregg-cbs

Bug report

Required System information

  • Node.js version: 18.6.0
  • NPM version: 9
  • Strapi version: 4.20.4

Describe the bug

In strapi 4.20.4 ctx.request.files is an empty object. In strapi 4.15.0 file upload to controllers were working fine. Since upgrading it is now broken.

Steps to reproduce the behavior

  1. Send a multipart form data to a controller
  2. Notice ctx.request.files is empty object
  3. Notice ctx.request.body.files is '[object object]'

Expected behavior

File to be attached to ctx.request.files as it was in 4.15.0 and as Koa recommends.

Screenshots

Frontend Request (tried with file and files as the property name)
image

Controller header which shows file incoming:
image

Controller context request string object and empty files:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions