From c3cbeae6e06654cb3c6b9e9c358addf7180e100f Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 7 Sep 2022 07:46:28 -0400 Subject: [PATCH] pkg: don't fetch image if not there Signed-off-by: Vincent Batts --- pkg/goldenaudiobooks/golden.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/goldenaudiobooks/golden.go b/pkg/goldenaudiobooks/golden.go index d77383a..b0edbe6 100644 --- a/pkg/goldenaudiobooks/golden.go +++ b/pkg/goldenaudiobooks/golden.go @@ -99,6 +99,10 @@ func BookFetcher(b *Book, dest string, createLocal bool) error { log.Infof("Image: %q", b.Image) err := func() error { + if b.Image == "" { + log.Infof("no image found. nothing fetched") + return nil + } fd, err := os.OpenFile(filepath.Join(p, "cover.jpg"), os.O_RDWR|os.O_CREATE, os.FileMode(0644)) if err != nil { return err