From 95d944613bffce1cee3783568ae229e116168ba4 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Sun, 29 Dec 2019 13:12:52 -0700 Subject: Export Replacer and use concrete type instead of interface The interface was only making things difficult; a concrete pointer is probably best. --- modules/caddyhttp/fileserver/matcher.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/caddyhttp/fileserver/matcher.go') diff --git a/modules/caddyhttp/fileserver/matcher.go b/modules/caddyhttp/fileserver/matcher.go index 5ca97f2..6c1e880 100644 --- a/modules/caddyhttp/fileserver/matcher.go +++ b/modules/caddyhttp/fileserver/matcher.go @@ -126,7 +126,7 @@ func (m MatchFile) Validate() error { // - http.matchers.file.relative // - http.matchers.file.absolute func (m MatchFile) Match(r *http.Request) bool { - repl := r.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer) + repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer) rel, abs, matched := m.selectFile(r) if matched { repl.Set("http.matchers.file.relative", rel) @@ -140,7 +140,7 @@ func (m MatchFile) Match(r *http.Request) bool { // It returns the root-relative path to the matched file, the full // or absolute path, and whether a match was made. func (m MatchFile) selectFile(r *http.Request) (rel, abs string, matched bool) { - repl := r.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer) + repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer) root := repl.ReplaceAll(m.Root, ".") -- cgit v1.2.3