Return 404 always on error

This commit is contained in:
Wim 2022-11-01 21:21:46 +01:00
parent 4511c4c017
commit 9ed3fcd793
No known key found for this signature in database

View File

@ -1,9 +1,7 @@
package gitea
import (
"errors"
"io"
"io/fs"
"net/http"
"strings"
@ -75,10 +73,8 @@ 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)
}
}
_, err = io.Copy(w, f)
return err