From: Giteabot Date: Wed, 3 Apr 2024 15:20:18 +0000 (+0800) Subject: Close file in the Upload func (#30262) (#30269) X-Git-Tag: v1.21.11~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4588c7b705629ffed3108d09d665937c14d39716;p=gitea.git Close file in the Upload func (#30262) (#30269) Co-authored-by: guangwu --- 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