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 {
150
150
allowOriginPatterns := []string {}
151
151
for _ , origin := range config .AllowOrigins {
152
152
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 , "\\ ?" , "." )
155
155
pattern = "^" + pattern + "$"
156
156
allowOriginPatterns = append (allowOriginPatterns , pattern )
157
157
}
Original file line number Diff line number Diff line change @@ -38,9 +38,9 @@ func rewriteRulesRegex(rewrite map[string]string) map[*regexp.Regexp]string {
38
38
rulesRegex := map [* regexp.Regexp ]string {}
39
39
for k , v := range rewrite {
40
40
k = regexp .QuoteMeta (k )
41
- k = strings .Replace (k , `\*` , "(.*?)" , - 1 )
41
+ k = strings .ReplaceAll (k , `\*` , "(.*?)" )
42
42
if strings .HasPrefix (k , `\^` ) {
43
- k = strings .Replace (k , `\^` , "^" , - 1 )
43
+ k = strings .ReplaceAll (k , `\^` , "^" )
44
44
}
45
45
k = k + "$"
46
46
rulesRegex [regexp .MustCompile (k )] = v
You can’t perform that action at this time.
0 commit comments