mirror of
https://github.com/caddyserver/caddy.git
synced 2026-05-18 13:12:13 -04: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:
@@ -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}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user