1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-24 08:57:03 -05:00

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

Co-authored-by: guangwu <guoguangwu@magic-shield.com>
(cherry picked from commit f45df3e3f9255e5adc68f14c4e18c1e26a301a64)
This commit is contained in:
Giteabot 2024-04-03 23:29:49 +08:00 committed by Earl Warren
parent 39bc868092
commit e83b6c7cd2
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 {
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