Skip to content

Commit

Permalink
fix MultiUpload when filesize=0
Browse files Browse the repository at this point in the history
  • Loading branch information
jojoliang committed Sep 28, 2020
1 parent 0e9536d commit cb662cd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions object.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,24 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string
if err != nil {
return nil, nil, err
}
if partNum == 0 {
var opt0 *ObjectPutOptions
if opt.OptIni != nil {
opt0 = &ObjectPutOptions{
opt.OptIni.ACLHeaderOptions,
opt.OptIni.ObjectPutHeaderOptions,
}
}
rsp, err := s.PutFromFile(ctx, name, filepath, opt0)
if err != nil {
return nil, rsp, err
}
result := &CompleteMultipartUploadResult{
Key: name,
ETag: rsp.Header.Get("ETag"),
}
return result, rsp, nil
}

// 2.Init
optini := opt.OptIni
Expand Down

0 comments on commit cb662cd

Please sign in to comment.