mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:08:31 +02:00
refactor(favicon): improve cache and error handling
This commit is contained in:
@@ -62,10 +62,10 @@ func (w *Watcher) wakeFromHTTP(rw http.ResponseWriter, r *http.Request) (shouldN
|
||||
|
||||
// handle favicon request
|
||||
if isFaviconPath(r.URL.Path) {
|
||||
result := api.GetFavIconFromAlias(r.Context(), w.route.Name())
|
||||
if !result.OK() {
|
||||
result, err := api.GetFavIconFromAlias(r.Context(), w.route.Name())
|
||||
if err != nil {
|
||||
rw.WriteHeader(result.StatusCode)
|
||||
fmt.Fprint(rw, result.ErrMsg)
|
||||
fmt.Fprint(rw, err)
|
||||
return false
|
||||
}
|
||||
rw.Header().Set("Content-Type", result.ContentType())
|
||||
|
||||
Reference in New Issue
Block a user