From f45df3e3f9255e5adc68f14c4e18c1e26a301a64 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Wed, 3 Apr 2024 23:29:49 +0800 Subject: [PATCH] Close file in the Upload func (#30262) (#30270) Co-authored-by: guangwu --- modules/lfs/filesystem_client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/lfs/filesystem_client.go b/modules/lfs/filesystem_client.go index 3503a9effc..71bef5c899 100644 --- a/modules/lfs/filesystem_client.go +++ b/modules/lfs/filesystem_client.go @@ -44,7 +44,7 @@ func (c *FilesystemClient) Download(ctx context.Context, objects []Pointer, call if err != nil { return err } - + defer f.Close() if err := callback(p, f, nil); err != nil { return err } @@ -75,7 +75,7 @@ func (c *FilesystemClient) Upload(ctx context.Context, objects []Pointer, callba if err != nil { return err } - + defer f.Close() _, err = io.Copy(f, content) return err