mirror of
https://github.com/caddyserver/caddy.git
synced 2025-04-23 05:07:50 +08:00
fileserver: Treat invalid file path as NotFound (#5099)
treat invalid file path as notFound so that PassThru can work
This commit is contained in:
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…
x
Reference in New Issue
Block a user