fix: make sure open cover and audio files are closed after use

This commit is contained in:
sentriz
2021-11-20 16:30:52 +00:00
committed by Senan Kelly
parent e10c8bafdf
commit 1d1ab116cd
2 changed files with 7 additions and 2 deletions

View File

@@ -445,6 +445,7 @@ func (p *Podcasts) downloadPodcastCover(podPath string, podcast *db.Podcast) err
if err != nil {
return fmt.Errorf("creating podcast cover: %w", err)
}
defer coverFile.Close()
if _, err := io.Copy(coverFile, resp.Body); err != nil {
return fmt.Errorf("writing podcast cover: %w", err)
}