mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-12-04 05:00:24 +08:00
优化URL匹配方法
This commit is contained in:
@@ -34,7 +34,7 @@ func (this *URLPattern) Init() error {
|
||||
for index, piece := range pieces {
|
||||
pieces[index] = regexp.QuoteMeta(piece)
|
||||
}
|
||||
reg, err := regexp.Compile("(?i)" /** 大小写不敏感 **/ + strings.Join(pieces, "(.*)"))
|
||||
reg, err := regexp.Compile("(?i)" /** 大小写不敏感 **/ + "^" + strings.Join(pieces, "(.*)") + "$")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user