mirror of https://github.com/Xhofe/alist
fix(onedrive,ali): upload progress
parent
7ac1d14eeb
commit
b73dce33aa
|
@ -256,7 +256,7 @@ func (d *AliDrive) Put(ctx context.Context, dstDir model.Obj, stream model.FileS
|
|||
file.ReadCloser = tempFile
|
||||
}
|
||||
|
||||
for _, partInfo := range resp.PartInfoList {
|
||||
for i, partInfo := range resp.PartInfoList {
|
||||
req, err := http.NewRequest("PUT", partInfo.UploadUrl, io.LimitReader(file, DEFAULT))
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -266,6 +266,7 @@ func (d *AliDrive) Put(ctx context.Context, dstDir model.Obj, stream model.FileS
|
|||
return err
|
||||
}
|
||||
res.Body.Close()
|
||||
up(i * 100 / count)
|
||||
}
|
||||
var resp2 base.Json
|
||||
_, err, e = d.request("https://api.aliyundrive.com/v2/file/complete", http.MethodPost, func(req *resty.Request) {
|
||||
|
|
|
@ -194,7 +194,7 @@ func (d *Onedrive) upBig(ctx context.Context, dstDir model.Obj, stream model.Fil
|
|||
return errors.New(string(data))
|
||||
}
|
||||
res.Body.Close()
|
||||
up(int(finish / stream.GetSize()))
|
||||
up(int(finish * 100 / stream.GetSize()))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue