From 2900ce51024e5dafdf23ca0c5a6280bd3bd48059 Mon Sep 17 00:00:00 2001 From: sentriz Date: Tue, 6 Jan 2026 19:45:37 +0000 Subject: [PATCH] fix(podcast): validate response status code when fetching podcast audio fixes #639 --- podcast/podcast.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/podcast/podcast.go b/podcast/podcast.go index 7fcbc93..808bb3f 100644 --- a/podcast/podcast.go +++ b/podcast/podcast.go @@ -508,6 +508,10 @@ func (p *Podcasts) doPodcastDownload(podcast *db.Podcast, podcastEpisode *db.Pod } defer resp.Body.Close() + if resp.StatusCode/100 != 2 { + return fmt.Errorf("fetch podcast audio: unexpected status %s", resp.Status) + } + filename, err := getPodcastEpisodeFilename(podcast, podcastEpisode, resp.Header) if err != nil { return fmt.Errorf("get podcast episode filename: %w", err)