mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
fix static server response code.
This commit is contained in:
parent
e95cc99ea2
commit
31eb743a5d
@ -45,11 +45,14 @@ func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, c
|
|||||||
fs := http.FileServer(http.Dir(config.Static))
|
fs := http.FileServer(http.Dir(config.Static))
|
||||||
router.Get("/*", func(w http.ResponseWriter, r *http.Request) error {
|
router.Get("/*", func(w http.ResponseWriter, r *http.Request) error {
|
||||||
_, err := os.Stat(config.Static + r.URL.Path)
|
_, err := os.Stat(config.Static + r.URL.Path)
|
||||||
|
if err == nil {
|
||||||
if !os.IsNotExist(err) {
|
|
||||||
fs.ServeHTTP(w, r)
|
fs.ServeHTTP(w, r)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
http.NotFound(w, r)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user