Skip to content

Commit

Permalink
podcast: make sure destination directory exists
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed Feb 20, 2024
1 parent c6cec83 commit b31f9d3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions podcast/podcast.go
Expand Up @@ -484,6 +484,9 @@ func (p *Podcasts) doPodcastDownload(podcast *db.Podcast, podcastEpisode *db.Pod
if err := p.db.Save(&podcastEpisode).Error; err != nil {
return fmt.Errorf("save podcast episode: %w", err)
}
if err := os.MkdirAll(filepath.Dir(podcastEpisode.Filename), os.ModePerm); err != nil {
return fmt.Errorf("make podcast root dir: %w", err)
}
file, err := os.Create(filepath.Join(podcast.RootDir, podcastEpisode.Filename))
if err != nil {
return fmt.Errorf("create audio file: %w", err)
Expand Down

0 comments on commit b31f9d3

Please sign in to comment.