Skip to content

Commit

Permalink
caddyhttp: remove duplicate strings.Count in path matcher (fixes #6233)…
Browse files Browse the repository at this point in the history
… (#6234)
  • Loading branch information
hlidotbe committed Apr 10, 2024
1 parent f4840cf commit 654a3bb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions modules/caddyhttp/matchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 654a3bb

Please sign in to comment.