diff --git a/packages/strapi-plugin-upload/admin/src/containers/HomePage/saga.js b/packages/strapi-plugin-upload/admin/src/containers/HomePage/saga.js index 76b4e67d88..19331f27e3 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/HomePage/saga.js +++ b/packages/strapi-plugin-upload/admin/src/containers/HomePage/saga.js @@ -1,6 +1,6 @@ // import { LOCATION_CHANGE } from 'react-router-redux'; import { Map } from 'immutable'; -import { isEmpty } from 'lodash'; +import { isEmpty, get, isObject } from 'lodash'; import { all, call, @@ -81,8 +81,11 @@ function* uploadFiles(action) { strapi.notification.success({ id: 'upload.notification.dropFiles.success', values: { number: newFiles.length } }); } - } catch(err) { - strapi.notification.error('notification.error'); + } catch(error) { + let message = get(error, ['response', 'payload', 'message', '0', 'messages', '0']); + if (isObject(message)) message = {...message, id: `upload.${message.id}`}; + + strapi.notification.error(message || 'notification.error'); } finally { yield put(unsetLoading()); } diff --git a/packages/strapi-plugin-upload/admin/src/translations/en.json b/packages/strapi-plugin-upload/admin/src/translations/en.json index 3abf220a52..61236983c7 100644 --- a/packages/strapi-plugin-upload/admin/src/translations/en.json +++ b/packages/strapi-plugin-upload/admin/src/translations/en.json @@ -24,5 +24,7 @@ "notification.config.success": "The settings has been updated", "notification.delete.success": "The file has been deleted", "notification.dropFile.success": "Your file has been uploaded", - "notification.dropFiles.success": "{number} files have been uploaded" -} \ No newline at end of file + "notification.dropFiles.success": "{number} files have been uploaded", + "Upload.status.sizeLimit": "{file} is bigger than configured limit size", + "Upload.status.disabled" : "File upload is disabled" +}