Merge pull request #4223 from gooolh/fix-chunk-upload

fix: 修复分块上传完成请求接口,参数partList错误
This commit is contained in:
hsm-lv 2022-05-06 10:15:01 +08:00 committed by GitHub
commit e87d5200f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1045,16 +1045,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
while (tasks.length) {
const res = await Promise.all(
tasks.splice(0, concurrency).map(async task => {
return await uploadPartFile(state, config)(
task,
(err: any, value: any) => {
if (err) {
reject(err);
throw new Error(err);
}
return value;
}
);
return await uploadPartFile(state, config)(task);
})
);
results = results.concat(res);
@ -1104,7 +1095,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
}
function uploadPartFile(state: ObjectState, conf: Partial<FileProps>) {
return (task: Task, callback: (error: any, value?: any) => void) => {
return (task: Task) => {
const api = buildApi(
conf.chunkApi!,
createObject(config.data, params),
@ -1137,12 +1128,11 @@ export default class FileControl extends React.Component<FileProps, FileState> {
)
.then(ret => {
state.loaded++;
callback(null, {
return {
partNumber: task.partNumber,
eTag: (ret.data as any).eTag
});
})
.catch(callback);
};
});
};
}