pkg: don't fetch image if not there

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2022-09-07 07:46:28 -04:00
parent 3124fa7a92
commit c3cbeae6e0
Signed by: vbatts
GPG key ID: 10937E57733F1362

View file

@ -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