1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-23 20:50:55 +00:00
This commit is contained in:
jianzhiyao 2020-11-30 20:22:52 +08:00
parent 99a47e7644
commit c034d3767a
2 changed files with 6 additions and 8 deletions

View File

@ -570,9 +570,6 @@ func splitSegment(key string) (bool, []string, string) {
param = make([]rune, 0) param = make([]rune, 0)
} else if v == '?' { } else if v == '?' {
params = append(params, ":") params = append(params, ":")
} else if v == '.' {
out = append(out, '\\')
out = append(out, v)
} else { } else {
out = append(out, v) out = append(out, v)
} }

View File

@ -94,9 +94,9 @@ func init() {
//not match example //not match example
// https://github.com/astaxie/beego/issues/3865 // https://github.com/astaxie/beego/issues/3865
routers = append(routers, notMatchTestInfo("/read_:id:int.htm", "/read_222htm")) routers = append(routers, notMatchTestInfo("/read_:id:int\\.htm", "/read_222htm"))
routers = append(routers, notMatchTestInfo("/read_:id:int.htm", "/read_222_htm")) routers = append(routers, notMatchTestInfo("/read_:id:int\\.htm", "/read_222_htm"))
routers = append(routers, notMatchTestInfo("/read_:id:int.htm", " /read_262shtm")) routers = append(routers, notMatchTestInfo("/read_:id:int\\.htm", " /read_262shtm"))
} }
@ -323,8 +323,9 @@ func TestSplitSegment(t *testing.T) {
":name:string": {true, []string{":name"}, `([\w]+)`}, ":name:string": {true, []string{":name"}, `([\w]+)`},
":id([0-9]+)": {true, []string{":id"}, `([0-9]+)`}, ":id([0-9]+)": {true, []string{":id"}, `([0-9]+)`},
":id([0-9]+)_:name": {true, []string{":id", ":name"}, `([0-9]+)_(.+)`}, ":id([0-9]+)_:name": {true, []string{":id", ":name"}, `([0-9]+)_(.+)`},
":id(.+)_cms.html": {true, []string{":id"}, `(.+)_cms\.html`}, ":id(.+)_cms.html": {true, []string{":id"}, `(.+)_cms.html`},
"cms_:id(.+)_:page(.+).html": {true, []string{":id", ":page"}, `cms_(.+)_(.+)\.html`}, ":id(.+)_cms\\.html": {true, []string{":id"}, `(.+)_cms\.html`},
"cms_:id(.+)_:page(.+).html": {true, []string{":id", ":page"}, `cms_(.+)_(.+).html`},
`:app(a|b|c)`: {true, []string{":app"}, `(a|b|c)`}, `:app(a|b|c)`: {true, []string{":app"}, `(a|b|c)`},
`:app\((a|b|c)\)`: {true, []string{":app"}, `(.+)\((a|b|c)\)`}, `:app\((a|b|c)\)`: {true, []string{":app"}, `(.+)\((a|b|c)\)`},
} }