fix: close resource (#4456)

This commit is contained in:
guangwu 2024-04-10 14:05:07 +08:00 committed by GitHub
parent 3e3f0d9452
commit 45f6a415de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,10 +120,12 @@ func (m minIoClient) Download(src, target string) (bool, error) {
if err != nil {
return false, err
}
defer object.Close()
localFile, err := os.Create(target)
if err != nil {
return false, err
}
defer localFile.Close()
if _, err = io.Copy(localFile, object); err != nil {
return false, err
}