From e847992c90a3143f8b02149f2d85f0b0ae019040 Mon Sep 17 00:00:00 2001 From: Yong-An9 <68688662+Yong-An9@users.noreply.github.com> Date: Tue, 10 Oct 2023 11:35:09 +0800 Subject: [PATCH] fixed close file twice issue when using dfstore upload large file (#2784) Co-authored-by: Yong.An --- client/daemon/objectstorage/objectstorage.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/client/daemon/objectstorage/objectstorage.go b/client/daemon/objectstorage/objectstorage.go index fab266d01b8..41ce5ed8488 100644 --- a/client/daemon/objectstorage/objectstorage.go +++ b/client/daemon/objectstorage/objectstorage.go @@ -579,11 +579,7 @@ func (o *objectStorage) importObjectToBackend(ctx context.Context, bucketName, o if err != nil { return err } - defer func() { - if cerr := f.Close(); cerr != nil { - err = errors.Join(err, cerr) - } - }() + defer f.Close() return o.objectStorageClient.PutObject(ctx, bucketName, objectKey, dgst.String(), f) }