0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-05-23 22:04:06 +02:00

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

Co-authored-by: guangwu <guoguangwu@magic-shield.com>
This commit is contained in:
Giteabot 2024-04-03 23:20:18 +08:00 committed by GitHub
parent 47de6e3b54
commit 4588c7b705
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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