mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-21 18:38:29 +08:00
internal: add internal paths to HiddenFiles (#2133)
* Append Internal paths to Caddy config HiddenFiles * gofmt * Reuse a variable * Update caddyhttp/internalsrv/setup.go Co-Authored-By: magikstm <myskina@gmail.com>
This commit is contained in:
parent
33b00dc8b1
commit
396d8e989f
|
@ -33,7 +33,12 @@ func setup(c *caddy.Controller) error {
|
|||
return err
|
||||
}
|
||||
|
||||
httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
|
||||
// Append Internal paths to Caddy config HiddenFiles to ensure
|
||||
// files do not appear in Browse
|
||||
config := httpserver.GetConfig(c)
|
||||
config.HiddenFiles = append(config.HiddenFiles, paths...)
|
||||
|
||||
config.AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
|
||||
return Internal{Next: next, Paths: paths}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user