diff options
author | Francis Lavoie <[email protected]> | 2024-10-11 19:55:50 -0400 |
---|---|---|
committer | Francis Lavoie <[email protected]> | 2024-11-04 14:10:51 -0500 |
commit | 7a0894c17acd6b862e042a20e5d44835828145af (patch) | |
tree | b0578211b6ab10196269cf384720f1dae6cd51d4 | |
parent | b3568a8b2c8c9ba42f4534933ba91f569844ac6f (diff) | |
download | caddy-7a0894c17acd6b862e042a20e5d44835828145af.tar.gz caddy-7a0894c17acd6b862e042a20e5d44835828145af.zip |
Clarifying comment since it's subtle that an err is returned
-rw-r--r-- | modules/caddyhttp/fileserver/matcher.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/caddyhttp/fileserver/matcher.go b/modules/caddyhttp/fileserver/matcher.go index 834ee2540..e78c99ec2 100644 --- a/modules/caddyhttp/fileserver/matcher.go +++ b/modules/caddyhttp/fileserver/matcher.go @@ -430,9 +430,13 @@ func (m MatchFile) selectFile(r *http.Request) (bool, error) { switch m.TryPolicy { case "", tryPolicyFirstExist: for _, pattern := range m.TryFiles { + // If the pattern is a status code, emit an error, + // which short-circuits the middleware pipeline and + // writes an HTTP error response. if err := parseErrorCode(pattern); err != nil { return false, err } + candidates := makeCandidates(pattern) for _, c := range candidates { if info, exists := m.strictFileExists(fileSystem, c.fullpath); exists { |