diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2019-12-29 13:12:52 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2019-12-29 13:12:52 -0700 |
commit | 95d944613bffce1cee3783568ae229e116168ba4 (patch) | |
tree | 8ccfe59b7852fbc1e937d62898cec52f92ee2c44 /modules/caddyhttp/fileserver/staticfiles.go | |
parent | 2b33d9a5e5d1bd12d27bea2cfe8341fd1e5703b2 (diff) |
Export Replacer and use concrete type instead of interface
The interface was only making things difficult; a concrete pointer is
probably best.
Diffstat (limited to 'modules/caddyhttp/fileserver/staticfiles.go')
-rw-r--r-- | modules/caddyhttp/fileserver/staticfiles.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/caddyhttp/fileserver/staticfiles.go b/modules/caddyhttp/fileserver/staticfiles.go index f2722ba..d6cf4d6 100644 --- a/modules/caddyhttp/fileserver/staticfiles.go +++ b/modules/caddyhttp/fileserver/staticfiles.go @@ -106,7 +106,7 @@ func (fsrv *FileServer) Provision(ctx caddy.Context) error { } func (fsrv *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error { - repl := r.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer) + repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer) filesToHide := fsrv.transformHidePaths(repl) @@ -293,7 +293,7 @@ func mapDirOpenError(originalErr error, name string) error { // transformHidePaths performs replacements for all the elements of // fsrv.Hide and returns a new list of the transformed values. -func (fsrv *FileServer) transformHidePaths(repl caddy.Replacer) []string { +func (fsrv *FileServer) transformHidePaths(repl *caddy.Replacer) []string { hide := make([]string, len(fsrv.Hide)) for i := range fsrv.Hide { hide[i] = repl.ReplaceAll(fsrv.Hide[i], "") |