File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,8 @@ func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc {
150150 allowOriginPatterns := []string {}
151151 for _ , origin := range config .AllowOrigins {
152152 pattern := regexp .QuoteMeta (origin )
153- pattern = strings .Replace (pattern , "\\ *" , ".*" , - 1 )
154- pattern = strings .Replace (pattern , "\\ ?" , "." , - 1 )
153+ pattern = strings .ReplaceAll (pattern , "\\ *" , ".*" )
154+ pattern = strings .ReplaceAll (pattern , "\\ ?" , "." )
155155 pattern = "^" + pattern + "$"
156156 allowOriginPatterns = append (allowOriginPatterns , pattern )
157157 }
Original file line number Diff line number Diff line change @@ -38,9 +38,9 @@ func rewriteRulesRegex(rewrite map[string]string) map[*regexp.Regexp]string {
3838 rulesRegex := map [* regexp.Regexp ]string {}
3939 for k , v := range rewrite {
4040 k = regexp .QuoteMeta (k )
41- k = strings .Replace (k , `\*` , "(.*?)" , - 1 )
41+ k = strings .ReplaceAll (k , `\*` , "(.*?)" )
4242 if strings .HasPrefix (k , `\^` ) {
43- k = strings .Replace (k , `\^` , "^" , - 1 )
43+ k = strings .ReplaceAll (k , `\^` , "^" )
4444 }
4545 k = k + "$"
4646 rulesRegex [regexp .MustCompile (k )] = v
You can’t perform that action at this time.
0 commit comments