From 9ed3fcd79394222532d5424a090210d2092f6f9f Mon Sep 17 00:00:00 2001 From: Wim Date: Tue, 1 Nov 2022 21:21:46 +0100 Subject: [PATCH] Return 404 always on error --- gitea.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gitea.go b/gitea.go index 0c05794..cdc92ce 100644 --- a/gitea.go +++ b/gitea.go @@ -1,9 +1,7 @@ package gitea import ( - "errors" "io" - "io/fs" "net/http" "strings" @@ -75,9 +73,7 @@ func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhtt f, err := m.Client.Open(fp, r.URL.Query().Get("ref")) if err != nil { - if errors.Is(err, fs.ErrNotExist) { - return caddyhttp.Error(http.StatusNotFound, err) - } + return caddyhttp.Error(http.StatusNotFound, err) } _, err = io.Copy(w, f)