From 843708b8b0d863781d490653c352666d6a20f565 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 10 Nov 2024 09:13:30 -0300 Subject: src/glaze.go: Return 404 instead of 500 on missing file --- src/glaze.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/glaze.go b/src/glaze.go index c70a2ec..959cf30 100644 --- a/src/glaze.go +++ b/src/glaze.go @@ -140,6 +140,14 @@ func handleDirectoryTarget(info pathInfo, w http.ResponseWriter, r *http.Request targetPath := withTrailingSlash(info.path) + r.URL.Path newInfo, fn, err := handlerForDynPath(targetPath) if err != nil { + is404 := + errors.Is(err, fs.ErrNotExist ) || + errors.Is(err, fs.ErrPermission) + if is404 { + httpError(w, http.StatusNotFound, err) + return nil + } + return err } -- cgit v1.2.3