Skip to content

Commit cb662cd

Browse files
author
jojoliang
committed
fix MultiUpload when filesize=0
1 parent 0e9536d commit cb662cd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

object.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,24 @@ func (s *ObjectService) Upload(ctx context.Context, name string, filepath string
620620
if err != nil {
621621
return nil, nil, err
622622
}
623+
if partNum == 0 {
624+
var opt0 *ObjectPutOptions
625+
if opt.OptIni != nil {
626+
opt0 = &ObjectPutOptions{
627+
opt.OptIni.ACLHeaderOptions,
628+
opt.OptIni.ObjectPutHeaderOptions,
629+
}
630+
}
631+
rsp, err := s.PutFromFile(ctx, name, filepath, opt0)
632+
if err != nil {
633+
return nil, rsp, err
634+
}
635+
result := &CompleteMultipartUploadResult{
636+
Key: name,
637+
ETag: rsp.Header.Get("ETag"),
638+
}
639+
return result, rsp, nil
640+
}
623641

624642
// 2.Init
625643
optini := opt.OptIni

0 commit comments

Comments
 (0)