Strapi users react-router-dom
v6
Strapi 5 uses koa-body
v6, which updates formidable
to v2. This means uploaded files have new properties.
This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.
🔌 Is this breaking change affecting plugins? | Yes |
---|
🤖 Is this breaking change automatically handled by a codemod? | No |
---|
Breaking change description
In Strapi v4
A user might create custom endpoints and handle files with the ctx
object:
const endpoint = (ctx) => {
ctx.request.files.fileName.path
ctx.request.files.fileName.name
ctx.request.files.fileName.type
}
In Strapi 5
A user might still create custom endpoints and handle files with the ctx
object, but the property names are different:
const endpoint = (ctx) => {
ctx.request.files.fileName.filepath
ctx.request.files.fileName.originalFilename
ctx.request.files.fileName.mimetype
}
Migration
This section regroups useful notes and procedures about the introduced breaking change.
Notes
- The official
koa-body
documentation lists the changes. - The official
formidable
documentation lists the changes.
Manual procedure
Users need to manually update the properties used in their custom code, referring to the official koa-body
and formidable
documentations.