From 7a8d337d5c6aee90294b2a86937df92287ca34e2 Mon Sep 17 00:00:00 2001 From: jojoliang Date: Sat, 27 Mar 2021 14:13:47 +0800 Subject: [PATCH] PutFromFile add retry --- object.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/object.go b/object.go index 9bd22d0..bf9ef66 100644 --- a/object.go +++ b/object.go @@ -220,9 +220,9 @@ func (s *ObjectService) Put(ctx context.Context, name string, r io.Reader, uopt func (s *ObjectService) PutFromFile(ctx context.Context, name string, filePath string, opt *ObjectPutOptions) (resp *Response, err error) { nr := 0 for nr < 3 { - var fd *os.File - fd, err = os.Open(filePath) - if err != nil { + fd, e := os.Open(filePath) + if e != nil { + err = e return } resp, err = s.Put(ctx, name, fd, opt)