pkg: don't fetch image if not there
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
3124fa7a92
commit
c3cbeae6e0
1 changed files with 4 additions and 0 deletions
|
@ -99,6 +99,10 @@ func BookFetcher(b *Book, dest string, createLocal bool) error {
|
||||||
log.Infof("Image: %q", b.Image)
|
log.Infof("Image: %q", b.Image)
|
||||||
|
|
||||||
err := func() error {
|
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))
|
fd, err := os.OpenFile(filepath.Join(p, "cover.jpg"), os.O_RDWR|os.O_CREATE, os.FileMode(0644))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue