fix(aliyundrive_open): the temp file is not delete (close #4777)

pull/4798/head
Andy Hsu 2023-07-16 15:01:22 +08:00
parent 3f7882b467
commit 6ec9a8d4c7
1 changed files with 2 additions and 1 deletions

View File

@ -228,6 +228,8 @@ func (d *AliyundriveOpen) upload(ctx context.Context, dstDir model.Obj, stream m
if err != nil {
return err
}
_ = stream.GetReadCloser().Close()
stream.SetReadCloser(file)
// calculate full hash
h := sha1.New()
_, err = io.Copy(h, file)
@ -260,7 +262,6 @@ func (d *AliyundriveOpen) upload(ctx context.Context, dstDir model.Obj, stream m
if _, err = file.Seek(0, io.SeekStart); err != nil {
return err
}
stream.SetReadCloser(file)
}
log.Debugf("[aliyundrive_open] create file success, resp: %+v", createResp)
return d.normalUpload(ctx, stream, up, createResp, count, partSize)