]> source.dussan.org Git - gitea.git/commitdiff
Close file in the Upload func (#30262) (#30269)
authorGiteabot <teabot@gitea.io>
Wed, 3 Apr 2024 15:20:18 +0000 (23:20 +0800)
committerGitHub <noreply@github.com>
Wed, 3 Apr 2024 15:20:18 +0000 (15:20 +0000)
Co-authored-by: guangwu <guoguangwu@magic-shield.com>
modules/lfs/filesystem_client.go

index 3503a9effc40bbfdacd2951ce971a16569326228..71bef5c899d6fe8c843123199531f061347be0cf 100644 (file)
@@ -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