1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-28 09:21:13 -05:00

Close file in the Upload func (#30262) (#30269)

Co-authored-by: guangwu <guoguangwu@magic-shield.com>
(cherry picked from commit 4588c7b705629ffed3108d09d665937c14d39716)
This commit is contained in:
Giteabot 2024-04-03 23:20:18 +08:00 committed by Earl Warren
parent 2ee30d2651
commit fd47240545
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -44,7 +44,7 @@ func (c *FilesystemClient) Download(ctx context.Context, objects []Pointer, call
if err != nil { if err != nil {
return err return err
} }
defer f.Close()
if err := callback(p, f, nil); err != nil { if err := callback(p, f, nil); err != nil {
return err return err
} }
@ -75,7 +75,7 @@ func (c *FilesystemClient) Upload(ctx context.Context, objects []Pointer, callba
if err != nil { if err != nil {
return err return err
} }
defer f.Close()
_, err = io.Copy(f, content) _, err = io.Copy(f, content)
return err return err