Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
53353fce
authored
2014-06-30 23:49:11 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
beego:fix the :id & * mixed router
1 parent
4dde2c59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
tree.go
tree_test.go
tree.go
View file @
53353fc
...
...
@@ -159,6 +159,10 @@ func (t *Tree) addseg(segments []string, route interface{}, wildcards []string,
iswild
=
true
regexpStr
=
seg
}
if
seg
==
"*"
&&
len
(
wildcards
)
>
0
&&
reg
==
""
{
iswild
=
true
regexpStr
=
"(.+)"
}
if
iswild
{
if
t
.
wildcard
==
nil
{
t
.
wildcard
=
NewTree
()
...
...
tree_test.go
View file @
53353fc
...
...
@@ -32,6 +32,9 @@ func init() {
routers
=
append
(
routers
,
testinfo
{
"/aa/*/bb"
,
"/aa/2009/bb"
,
map
[
string
]
string
{
":splat"
:
"2009"
}})
routers
=
append
(
routers
,
testinfo
{
"/cc/*/dd"
,
"/cc/2009/11/dd"
,
map
[
string
]
string
{
":splat"
:
"2009/11"
}})
routers
=
append
(
routers
,
testinfo
{
"/ee/:year/*/ff"
,
"/ee/2009/11/ff"
,
map
[
string
]
string
{
":year"
:
"2009"
,
":splat"
:
"11"
}})
routers
=
append
(
routers
,
testinfo
{
"/thumbnail/:size/uploads/*"
,
"/thumbnail/100x100/uploads/items/2014/04/20/dPRCdChkUd651t1Hvs18.jpg"
,
map
[
string
]
string
{
":size"
:
"100x100"
,
":splat"
:
"items/2014/04/20/dPRCdChkUd651t1Hvs18.jpg"
}})
routers
=
append
(
routers
,
testinfo
{
"/*.*"
,
"/nice/api.json"
,
map
[
string
]
string
{
":path"
:
"nice/api"
,
":ext"
:
"json"
}})
routers
=
append
(
routers
,
testinfo
{
"/:name/*.*"
,
"/nice/api.json"
,
map
[
string
]
string
{
":name"
:
"nice"
,
":path"
:
"api"
,
":ext"
:
"json"
}})
routers
=
append
(
routers
,
testinfo
{
"/:name/test/*.*"
,
"/nice/test/api.json"
,
map
[
string
]
string
{
":name"
:
"nice"
,
":path"
:
"api"
,
":ext"
:
"json"
}})
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment