fileserver: Treat invalid file path as NotFound (#5099)
treat invalid file path as notFound so that PassThru can workpull/5108/head
parent
01e192edc9
commit
2be56c526c
|
@ -247,7 +247,7 @@ func (fsrv *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request, next c
|
|||
info, err := fs.Stat(fsrv.fileSystem, filename)
|
||||
if err != nil {
|
||||
err = fsrv.mapDirOpenError(err, filename)
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
if errors.Is(err, fs.ErrNotExist) || errors.Is(err, fs.ErrInvalid) {
|
||||
return fsrv.notFound(w, r, next)
|
||||
} else if errors.Is(err, fs.ErrPermission) {
|
||||
return caddyhttp.Error(http.StatusForbidden, err)
|
||||
|
|
Loading…
Reference in New Issue