balibabu
commited on
Commit
·
930da24
1
Parent(s):
ad65b9b
fix: Fixed the issue where no error message was displayed when uploading a file that was too large #2258 (#2697)
Browse files### What problem does this PR solve?
fix: Fixed the issue where no error message was displayed when uploading
a file that was too large #2258
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- web/src/locales/en.ts +1 -0
- web/src/locales/zh-traditional.ts +1 -0
- web/src/locales/zh.ts +1 -0
- web/src/utils/request.ts +6 -0
web/src/locales/en.ts
CHANGED
@@ -604,6 +604,7 @@ The above is the content you need to summarize.`,
|
|
604 |
404: 'The request was made for a record that does not exist, and the server did not perform the operation.',
|
605 |
406: 'The requested format is not available.',
|
606 |
410: 'The requested resource has been permanently deleted and will not be available again.',
|
|
|
607 |
422: 'When creating an object, a validation error occurred.',
|
608 |
500: 'A server error occurred, please check the server.',
|
609 |
502: 'Gateway error.',
|
|
|
604 |
404: 'The request was made for a record that does not exist, and the server did not perform the operation.',
|
605 |
406: 'The requested format is not available.',
|
606 |
410: 'The requested resource has been permanently deleted and will not be available again.',
|
607 |
+
413: 'The total size of the files uploaded at once is too large.',
|
608 |
422: 'When creating an object, a validation error occurred.',
|
609 |
500: 'A server error occurred, please check the server.',
|
610 |
502: 'Gateway error.',
|
web/src/locales/zh-traditional.ts
CHANGED
@@ -563,6 +563,7 @@ export default {
|
|
563 |
404: '發出的請求針對的是不存在的記錄,服務器沒有進行操作。',
|
564 |
406: '請求的格式不可得。',
|
565 |
410: '請求的資源被永久刪除,且不會再得到的。',
|
|
|
566 |
422: '當創建一個對象時,發生一個驗證錯誤。',
|
567 |
500: '服務器發生錯誤,請檢查服務器。',
|
568 |
502: '網關錯誤。',
|
|
|
563 |
404: '發出的請求針對的是不存在的記錄,服務器沒有進行操作。',
|
564 |
406: '請求的格式不可得。',
|
565 |
410: '請求的資源被永久刪除,且不會再得到的。',
|
566 |
+
413: '上傳的檔案總大小太大',
|
567 |
422: '當創建一個對象時,發生一個驗證錯誤。',
|
568 |
500: '服務器發生錯誤,請檢查服務器。',
|
569 |
502: '網關錯誤。',
|
web/src/locales/zh.ts
CHANGED
@@ -580,6 +580,7 @@ export default {
|
|
580 |
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
|
581 |
406: '请求的格式不可得。',
|
582 |
410: '请求的资源被永久删除,且不会再得到的。',
|
|
|
583 |
422: '当创建一个对象时,发生一个验证错误。',
|
584 |
500: '服务器发生错误,请检查服务器。',
|
585 |
502: '网关错误。',
|
|
|
580 |
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
|
581 |
406: '请求的格式不可得。',
|
582 |
410: '请求的资源被永久删除,且不会再得到的。',
|
583 |
+
413: '上传的文件总大小过大。',
|
584 |
422: '当创建一个对象时,发生一个验证错误。',
|
585 |
500: '服务器发生错误,请检查服务器。',
|
586 |
502: '网关错误。',
|
web/src/utils/request.ts
CHANGED
@@ -22,6 +22,7 @@ const RetcodeMessage = {
|
|
22 |
404: i18n.t('message.404'),
|
23 |
406: i18n.t('message.406'),
|
24 |
410: i18n.t('message.410'),
|
|
|
25 |
422: i18n.t('message.422'),
|
26 |
500: i18n.t('message.500'),
|
27 |
502: i18n.t('message.502'),
|
@@ -39,6 +40,7 @@ type ResultCode =
|
|
39 |
| 404
|
40 |
| 406
|
41 |
| 410
|
|
|
42 |
| 422
|
43 |
| 500
|
44 |
| 502
|
@@ -97,6 +99,10 @@ request.interceptors.request.use((url: string, options: any) => {
|
|
97 |
});
|
98 |
|
99 |
request.interceptors.response.use(async (response: any, options) => {
|
|
|
|
|
|
|
|
|
100 |
if (options.responseType === 'blob') {
|
101 |
return response;
|
102 |
}
|
|
|
22 |
404: i18n.t('message.404'),
|
23 |
406: i18n.t('message.406'),
|
24 |
410: i18n.t('message.410'),
|
25 |
+
413: i18n.t('message.413'),
|
26 |
422: i18n.t('message.422'),
|
27 |
500: i18n.t('message.500'),
|
28 |
502: i18n.t('message.502'),
|
|
|
40 |
| 404
|
41 |
| 406
|
42 |
| 410
|
43 |
+
| 413
|
44 |
| 422
|
45 |
| 500
|
46 |
| 502
|
|
|
99 |
});
|
100 |
|
101 |
request.interceptors.response.use(async (response: any, options) => {
|
102 |
+
if (response?.status === 413) {
|
103 |
+
message.error(RetcodeMessage[413]);
|
104 |
+
}
|
105 |
+
|
106 |
if (options.responseType === 'blob') {
|
107 |
return response;
|
108 |
}
|