mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +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)
|
resp, err := U.Get(url)
|
||||||
if err != nil {
|
if err != nil || resp.StatusCode != http.StatusOK {
|
||||||
storeIconCache(url, nil)
|
if err == nil {
|
||||||
|
err = errors.New(resp.Status)
|
||||||
|
}
|
||||||
logging.Error().Err(err).
|
logging.Error().Err(err).
|
||||||
Str("url", url).
|
Str("url", url).
|
||||||
Msg("failed to get icon")
|
Msg("failed to get icon")
|
||||||
|
@ -142,7 +144,6 @@ func getIconAbsolute(url string) ([]byte, int, string) {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
icon, err = io.ReadAll(resp.Body)
|
icon, err = io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// storeIconCache(url, nil) // can retry
|
|
||||||
logging.Error().Err(err).
|
logging.Error().Err(err).
|
||||||
Str("url", url).
|
Str("url", url).
|
||||||
Msg("failed to read icon")
|
Msg("failed to read icon")
|
||||||
|
|
Loading…
Add table
Reference in a new issue