From 73e6410fd220c21df13bf6e8ff6779fa508e0ebc Mon Sep 17 00:00:00 2001 From: Aaron Fischer Date: Mon, 11 Mar 2024 22:19:32 +0100 Subject: [PATCH] do not download broken files --- src/bdm.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bdm.go b/src/bdm.go index 194e865..38ddb82 100644 --- a/src/bdm.go +++ b/src/bdm.go @@ -46,6 +46,10 @@ func (i Item) downloadCover() error { } }(resp.Body) + if resp.StatusCode != 200 { + return fmt.Errorf("HTTP status code is %d", resp.StatusCode) + } + out, err := os.Create(i.targetFilename()) if err != nil { return err