From 654a3bb09095425a1260895dd2edf09edc3403e8 Mon Sep 17 00:00:00 2001 From: Hugues Lismonde Date: Wed, 10 Apr 2024 16:38:10 +0200 Subject: [PATCH] caddyhttp: remove duplicate strings.Count in path matcher (fixes #6233) (#6234) --- modules/caddyhttp/matchers.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go index 7a0c47e6..6e770c5e 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 }