caddyhttp: remove duplicate strings.Count in path matcher (fixes #6233) (#6234)

This commit is contained in:
Hugues Lismonde 2024-04-10 16:38:10 +02:00 committed by GitHub
parent f4840cfeb8
commit 654a3bb090
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 2 deletions

View File

@ -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
}