Skip to content

Commit

Permalink
fix(139): upload empty file (close #4711)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jul 27, 2023
1 parent 0c1acd7 commit cfd23c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/139/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ func (d *Yun139) Put(ctx context.Context, dstDir model.Obj, stream model.FileStr

var partSize = getPartSize(stream.GetSize())
part := (stream.GetSize() + partSize - 1) / partSize
if part == 0 {
part = 1
}
for i := int64(0); i < part; i++ {
if utils.IsCanceled(ctx) {
return ctx.Err()
Expand Down Expand Up @@ -331,13 +334,11 @@ func (d *Yun139) Put(ctx context.Context, dstDir model.Obj, stream model.FileStr
if err != nil {
return err
}
_ = res.Body.Close()
log.Debugf("%+v", res)

if res.StatusCode != http.StatusOK {
return fmt.Errorf("unexpected status code: %d", res.StatusCode)
}

res.Body.Close()
}

return nil
Expand Down

0 comments on commit cfd23c0

Please sign in to comment.