mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-29 09:07:30 +08:00
improve (404): 404 errors
This commit is contained in:
@ -70,8 +70,12 @@ func IndexHandler(_path string) func(*App, http.ResponseWriter, *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NotFoundHandler(ctx *App, res http.ResponseWriter, req *http.Request) {
|
func NotFoundHandler(ctx *App, res http.ResponseWriter, req *http.Request) {
|
||||||
res.WriteHeader(http.StatusNotFound)
|
if strings.Contains(req.Header.Get("accept"), "text/html") {
|
||||||
res.Write(HtmlPage404)
|
res.WriteHeader(http.StatusNotFound)
|
||||||
|
res.Write(HtmlPage404)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
SendErrorResult(res, ErrNotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PreflightCorsOK(ctx *App, res http.ResponseWriter, req *http.Request) {
|
func PreflightCorsOK(ctx *App, res http.ResponseWriter, req *http.Request) {
|
||||||
|
|||||||
Reference in New Issue
Block a user