mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 12:38:53 +08:00
fix: 修复分块参数partList错误
This commit is contained in:
parent
1882311269
commit
63c93a922a
@ -1045,16 +1045,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|||||||
while (tasks.length) {
|
while (tasks.length) {
|
||||||
const res = await Promise.all(
|
const res = await Promise.all(
|
||||||
tasks.splice(0, concurrency).map(async task => {
|
tasks.splice(0, concurrency).map(async task => {
|
||||||
return await uploadPartFile(state, config)(
|
return await uploadPartFile(state, config)(task);
|
||||||
task,
|
|
||||||
(err: any, value: any) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
throw new Error(err);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
results = results.concat(res);
|
results = results.concat(res);
|
||||||
@ -1104,7 +1095,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function uploadPartFile(state: ObjectState, conf: Partial<FileProps>) {
|
function uploadPartFile(state: ObjectState, conf: Partial<FileProps>) {
|
||||||
return (task: Task, callback: (error: any, value?: any) => void) => {
|
return (task: Task) => {
|
||||||
const api = buildApi(
|
const api = buildApi(
|
||||||
conf.chunkApi!,
|
conf.chunkApi!,
|
||||||
createObject(config.data, params),
|
createObject(config.data, params),
|
||||||
@ -1137,12 +1128,11 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|||||||
)
|
)
|
||||||
.then(ret => {
|
.then(ret => {
|
||||||
state.loaded++;
|
state.loaded++;
|
||||||
callback(null, {
|
return {
|
||||||
partNumber: task.partNumber,
|
partNumber: task.partNumber,
|
||||||
eTag: (ret.data as any).eTag
|
eTag: (ret.data as any).eTag
|
||||||
});
|
};
|
||||||
})
|
});
|
||||||
.catch(callback);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user