1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

fix: 解决部分文件上传失败的问题 (#3343)

This commit is contained in:
zhengkunwang 2023-12-15 15:46:08 +08:00 committed by GitHub
parent a9d8018e78
commit b2926019cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,6 +94,7 @@ import i18n from '@/lang';
import DrawerHeader from '@/components/drawer-header/index.vue';
import { MsgError, MsgSuccess } from '@/utils/message';
import { Close } from '@element-plus/icons-vue';
import { TimeoutEnum } from '@/enums/http-enum';
interface UploadFileProps {
path: string;
@ -235,7 +236,7 @@ const submit = async () => {
const fileSize = file.size;
uploadHelper.value = i18n.global.t('file.fileUploadStart', [file.name]);
if (fileSize <= 1024 * 1024 * 10) {
if (fileSize <= 1024 * 1024 * 5) {
const formData = new FormData();
formData.append('file', file.raw);
if (file.raw.webkitRelativePath != '') {
@ -254,7 +255,7 @@ const submit = async () => {
success++;
uploaderFiles.value[i].status = 'success';
} else {
const CHUNK_SIZE = 1024 * 1024 * 10;
const CHUNK_SIZE = 1024 * 1024 * 5;
const chunkCount = Math.ceil(fileSize / CHUNK_SIZE);
let uploadedChunkCount = 0;
for (let c = 0; c < chunkCount; c++) {
@ -281,7 +282,7 @@ const submit = async () => {
);
uploadPrecent.value = progress;
},
timeout: 40000,
timeout: TimeoutEnum.T_60S,
});
uploadedChunkCount++;
} catch (error) {