mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 04:42:33 +02:00
fix favicon on non http 200
This commit is contained in:
parent
1abd1e257f
commit
d887a37f60
1 changed files with 4 additions and 3 deletions
|
@ -131,8 +131,10 @@ func getIconAbsolute(url string) ([]byte, int, string) {
|
|||
}
|
||||
|
||||
resp, err := U.Get(url)
|
||||
if err != nil {
|
||||
storeIconCache(url, nil)
|
||||
if err != nil || resp.StatusCode != http.StatusOK {
|
||||
if err == nil {
|
||||
err = errors.New(resp.Status)
|
||||
}
|
||||
logging.Error().Err(err).
|
||||
Str("url", url).
|
||||
Msg("failed to get icon")
|
||||
|
@ -142,7 +144,6 @@ func getIconAbsolute(url string) ([]byte, int, string) {
|
|||
defer resp.Body.Close()
|
||||
icon, err = io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
// storeIconCache(url, nil) // can retry
|
||||
logging.Error().Err(err).
|
||||
Str("url", url).
|
||||
Msg("failed to read icon")
|
||||
|
|
Loading…
Add table
Reference in a new issue