mirror of
https://github.com/strapi/strapi.git
synced 2025-10-19 03:49:45 +00:00
Merge pull request #13976 from strapi/fix/upload-proxy-error-gracefully
Upload: Handle file upload errors gracefully
This commit is contained in:
commit
eb7dbd39d7
@ -108,10 +108,21 @@ export const UploadingAssetCard = ({
|
|||||||
</Card>
|
</Card>
|
||||||
{error ? (
|
{error ? (
|
||||||
<Typography variant="pi" fontWeight="bold" textColor="danger600">
|
<Typography variant="pi" fontWeight="bold" textColor="danger600">
|
||||||
{formatMessage({
|
{formatMessage(
|
||||||
id: getTrad(`apiError.${error.response.data.error.message}`),
|
error?.response?.data?.error?.message
|
||||||
defaultMessage: error.response.data.error.message,
|
? {
|
||||||
})}
|
id: getTrad(`apiError.${error.response.data.error.message}`),
|
||||||
|
defaultMessage: error.response.data.error.message,
|
||||||
|
/* See issue: https://github.com/strapi/strapi/issues/13867
|
||||||
|
A proxy might return an error, before the request reaches Strapi
|
||||||
|
and therefore we need to handle errors gracefully.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
id: getTrad('upload.generic-error'),
|
||||||
|
defaultMessage: 'An error occured while uploading the file.',
|
||||||
|
}
|
||||||
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
) : (
|
) : (
|
||||||
undefined
|
undefined
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"apiError.FileTooBig": "The uploaded file exceeds the maximum allowed asset size.",
|
"apiError.FileTooBig": "The uploaded file exceeds the maximum allowed asset size.",
|
||||||
|
"upload.generic-error": "An error occurred while uploading the file.",
|
||||||
"bulk.select.label": "Select all assets",
|
"bulk.select.label": "Select all assets",
|
||||||
"button.next": "Next",
|
"button.next": "Next",
|
||||||
"checkControl.crop-duplicate": "Duplicate & crop the asset",
|
"checkControl.crop-duplicate": "Duplicate & crop the asset",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user