Skip to content

Commit a686f5c

Browse files
committed
Merge branch 'dev-jojoliang' into 'master' (merge request !140)
dev-jojoliang fix inventory, fix put zero file
2 parents 7f2a9c7 + bfc3bb0 commit a686f5c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

bucket_inventory.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ type BucketInventoryOptionalFields struct {
3535

3636
// BucketInventorySchedule ...
3737
type BucketInventorySchedule struct {
38-
Frequency string `xml:"Frequency"`
39-
MonthlyDate int `xml:"MonthlyDate"`
38+
Frequency string `xml:"Frequency,omitempty"`
39+
MonthlyDate int `xml:"MonthlyDate,omitempty"`
4040
}
4141

4242
// BucketInventoryEncryption ...

object.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,13 @@ func (s *ObjectService) Put(ctx context.Context, name string, r io.Reader, uopt
514514
// 如果长度为0,则配置为NoBody,避免使用chunk上传
515515
if isNoBody {
516516
sendOpt.body = http.NoBody
517+
if nr == 0 {
518+
defer func() {
519+
if rc, ok := r.(io.ReadCloser); ok {
520+
rc.Close()
521+
}
522+
}()
523+
}
517524
}
518525

519526
// 把上一次错误记录下来

0 commit comments

Comments
 (0)