diff --git a/docs/developer-docs/latest/development/providers.md b/docs/developer-docs/latest/development/providers.md index 4cb30d513f..04a19a3010 100644 --- a/docs/developer-docs/latest/development/providers.md +++ b/docs/developer-docs/latest/development/providers.md @@ -151,6 +151,11 @@ module.exports = { delete(file) { // delete the file in the provider }, + checkFileSize(file, { sizeLimit }) { + // implement your own file size limit logic + // there is a default logic in place if this + // method is not implemented + }, }; }, }; diff --git a/docs/developer-docs/latest/plugins/upload.md b/docs/developer-docs/latest/plugins/upload.md index cb25dda41c..1cc5b04105 100644 --- a/docs/developer-docs/latest/plugins/upload.md +++ b/docs/developer-docs/latest/plugins/upload.md @@ -135,7 +135,7 @@ export default [ -In addition to the middleware configuration, you can pass the `sizeLimit`, which is an integer in bytes, in the `providerOptions` of the [plugin configuration](/developer-docs/latest/setup-deployment-guides/configurations/optional/plugins.md) in `./config/plugins.js`: +In addition to the middleware configuration, you can pass the `sizeLimit`, which is an integer in bytes, in the [plugin configuration](/developer-docs/latest/setup-deployment-guides/configurations/optional/plugins.md) in `./config/plugins.js`: @@ -148,9 +148,7 @@ module.exports = { // ... upload: { config: { - providerOptions: { - sizeLimit: 250 * 1024 * 1024 // 256mb in bytes - } + sizeLimit: 250 * 1024 * 1024 // 256mb in bytes } } }; diff --git a/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.5.1-to-4.6.1.md b/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.5.1-to-4.6.1.md index 5d2be00770..b869df6a99 100644 --- a/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.5.1-to-4.6.1.md +++ b/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.5.1-to-4.6.1.md @@ -6,10 +6,13 @@ canonicalUrl: https://docs.strapi.io/developer-docs/latest/update-migration-guid # v4.5.1+ to v4.6.1 migration guide -The Strapi v4.5.1+ to v4.6.1 migration guide upgrades v4.5.1+ to v4.6.1. We introduced a configuration for webhooks to receive populated relations. The migration guide consists of: +The Strapi v4.5.1+ to v4.6.1 migration guide upgrades v4.5.1+ to v4.6.1. We introduced a configuration for webhooks to receive populated relations. Also, this migration guide is needed for all users who were limiting media size for the local upload provider. + +The migration guide consists of: - Upgrading the application dependencies - Changing the webhooks configuration (optional) +- Updating the local upload provider `sizeLimit` - Reinitializing the application ## Upgrading the application dependencies to 4.6.1 @@ -66,4 +69,64 @@ With this, you will no longer receive populated relations in webhooks, and **res You can see more of the available configuration options in the [server configuration documentation](/developer-docs/latest/setup-deployment-guides/configurations/required/server.md). +## Updating the sizeLimit provider configuration + +This step is only required if you were using the [`sizeLimit` configuration](/developer-docs/latest/plugins/upload.md#max-file-size) for your upload provider. + +:::caution +The documentation required the `sizeLimit` to be in bytes, but it was actually in kilobytes. This is now fixed, and the limit will be interpreted as bytes. + +If you, for some reason, were limiting the file size to kilobytes, you should update the value to be in bytes. +::: + +We recommend to move the `sizeLimit` outside the provider options like the following, as it will be deprecated in the next major version. + + + + +```js +// path: ./config/plugins.js + +module.exports = { + // ... + upload: { + config: { + sizeLimit: 250 * 1024 * 1024 // Now + providerOptions: { + sizeLimit: 250 * 1024 * 1024 // Before + } + } + } +}; +``` + + + + + +```js +// path: ./config/plugins.ts + +export default { + // ... + upload: { + config: { + sizeLimit: 250 * 1024 * 1024 // Now + providerOptions: { + sizeLimit: 250 * 1024 * 1024 // Before + } + } + } +}; +``` + + + + + +To change the script: + +1. In the `./config/plugins.js` file, identify the upload configuration if you have one. +2. (_optional_) If you have a `sizeLimit`, move it one level above `providerOptions`. + !!!include(developer-docs/latest/update-migration-guides/migration-guides/v4/snippets/Rebuild-and-start-snippet.md)!!!