added file extention to cache

This commit is contained in:
Hazel Noack
2025-07-15 13:58:44 +02:00
parent fb6afc2ffe
commit 3396109e00
3 changed files with 6 additions and 5 deletions

View File

@@ -118,7 +118,7 @@ func (rc *Config) ScanForConfigFile(profile string) error {
return err
}
return errors.New("No config file found")
return errors.New("no config file found")
}
func (rc *Config) LoadConfigFile(file string) error {
@@ -138,9 +138,12 @@ func (rc *Config) LoadConfigFile(file string) error {
}
func (c *Config) Init() error {
fmt.Print("downloading website icons")
for i, _ := range c.Template.Websites {
fmt.Print(".")
c.Template.Websites[i].Cache()
}
fmt.Print("\n")
return nil
}

View File

@@ -3,7 +3,6 @@ package rendering
import (
"crypto/sha1"
"encoding/hex"
"fmt"
"io"
"net/http"
"net/url"
@@ -49,8 +48,7 @@ func (w *Website) Cache() error {
return err
}
filename := hashUrl(w.ImageUrl)
fmt.Println(w.ImageUrl + " => " + filename)
filename := hashUrl(w.ImageUrl) + filepath.Ext(w.ImageUrl)
targetPath := filepath.Join(cacheDir, filename)
resp, err := http.Get(w.ImageUrl)
if err != nil {