From 8ede9f1a44e5b11b2d2b647b03922e17c2331430 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Sun, 9 Oct 2022 17:00:47 -0400 Subject: Fix broken 404 page on Windows by using appropriate error checking. --- page/render.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/page/render.go b/page/render.go index d35ba38..691a258 100644 --- a/page/render.go +++ b/page/render.go @@ -2,9 +2,10 @@ package page import ( "bytes" + "errors" + "io/fs" "net/http" "path/filepath" - "strings" ) func getURLPath(r *http.Request) string { @@ -112,7 +113,7 @@ func Render(w http.ResponseWriter, r *http.Request, err := p.Render(buf) if err != nil { - if strings.HasSuffix(err.Error(), "no such file or directory") { + if errors.Is(err, fs.ErrNotExist) { Render4xx(w, r, vars, http.StatusNotFound) return -- cgit v1.2.3