diff options
author | Francis Lavoie <[email protected]> | 2024-10-13 18:06:37 -0400 |
---|---|---|
committer | Francis Lavoie <[email protected]> | 2024-11-04 14:10:51 -0500 |
commit | 03667c64b10e42c62f5eaa351023cbf41338a4f5 (patch) | |
tree | 6f462d23ac138a8817d3ee82dabd20e1bffbcee7 | |
parent | f66b5a19981554cb4901f8979934bca849d86b79 (diff) | |
download | caddy-03667c64b10e42c62f5eaa351023cbf41338a4f5.tar.gz caddy-03667c64b10e42c62f5eaa351023cbf41338a4f5.zip |
Lintermatcher-with-error
-rw-r--r-- | caddyconfig/httpcaddyfile/httptype.go | 1 | ||||
-rw-r--r-- | modules/caddyhttp/fileserver/matcher.go | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go index beee2d1a5..c169b92af 100644 --- a/caddyconfig/httpcaddyfile/httptype.go +++ b/caddyconfig/httpcaddyfile/httptype.go @@ -1532,6 +1532,7 @@ func parseMatcherDefinitions(d *caddyfile.Dispenser, matchers map[string]caddy.M matchers[definitionName][matcherName] = caddyconfig.JSON(rm, nil) return nil } + // nolint:staticcheck if rm, ok := unm.(caddyhttp.RequestMatcher); ok { matchers[definitionName][matcherName] = caddyconfig.JSON(rm, nil) return nil diff --git a/modules/caddyhttp/fileserver/matcher.go b/modules/caddyhttp/fileserver/matcher.go index e78c99ec2..c42907491 100644 --- a/modules/caddyhttp/fileserver/matcher.go +++ b/modules/caddyhttp/fileserver/matcher.go @@ -173,7 +173,7 @@ func (m *MatchFile) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { func (MatchFile) CELLibrary(ctx caddy.Context) (cel.Library, error) { requestType := cel.ObjectType("http.Request") - matcherFactory := func(data ref.Val) (caddyhttp.RequestMatcher, error) { + matcherFactory := func(data ref.Val) (caddyhttp.RequestMatcherWithError, error) { values, err := caddyhttp.CELValueToMapStrList(data) if err != nil { return nil, err @@ -315,6 +315,7 @@ func (m MatchFile) Validate() error { func (m MatchFile) Match(r *http.Request) bool { match, err := m.selectFile(r) if err != nil { + // nolint:staticcheck caddyhttp.SetVar(r.Context(), caddyhttp.MatcherErrorVarKey, err) } return match |