Return 404 always on error
This commit is contained in:
parent
4511c4c017
commit
9ed3fcd793
4
gitea.go
4
gitea.go
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user