fix: 修复分块参数partList错误

This commit is contained in:
liujintao03 2022-05-05 20:21:38 +08:00
parent 1882311269
commit 63c93a922a

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);
};
});
};
}