aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHugues Lismonde <[email protected]>2024-04-10 16:38:10 +0200
committerGitHub <[email protected]>2024-04-10 08:38:10 -0600
commit654a3bb09095425a1260895dd2edf09edc3403e8 (patch)
tree12a821e502f43e7755b6de109b9e93e9f190d7f9
parentf4840cfeb85ac33d29a1ab88d474750041a98733 (diff)
downloadcaddy-654a3bb09095425a1260895dd2edf09edc3403e8.tar.gz
caddy-654a3bb09095425a1260895dd2edf09edc3403e8.zip
caddyhttp: remove duplicate strings.Count in path matcher (fixes #6233) (#6234)
-rw-r--r--modules/caddyhttp/matchers.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go
index 7a0c47e67..6e770c5e6 100644
--- a/modules/caddyhttp/matchers.go
+++ b/modules/caddyhttp/matchers.go
@@ -456,8 +456,7 @@ func (m MatchPath) Match(r *http.Request) bool {
// treat it as a fast substring match
if strings.Count(matchPattern, "*") == 2 &&
strings.HasPrefix(matchPattern, "*") &&
- strings.HasSuffix(matchPattern, "*") &&
- strings.Count(matchPattern, "*") == 2 {
+ strings.HasSuffix(matchPattern, "*") {
if strings.Contains(reqPathForPattern, matchPattern[1:len(matchPattern)-1]) {
return true
}