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
c4d8e4a2
authored
2014-11-04 15:29:33 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix #759
1 parent
9d4ec508
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
router.go
router.go
View file @
c4d8e4a
...
...
@@ -452,8 +452,8 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
}
controllName
:=
strings
.
Join
(
paths
[
:
len
(
paths
)
-
1
],
"/"
)
methodName
:=
paths
[
len
(
paths
)
-
1
]
for
_
,
t
:=
range
p
.
routers
{
ok
,
url
:=
p
.
geturl
(
t
,
"/"
,
controllName
,
methodName
,
params
)
for
m
,
t
:=
range
p
.
routers
{
ok
,
url
:=
p
.
geturl
(
t
,
"/"
,
controllName
,
methodName
,
params
,
m
)
if
ok
{
return
url
}
...
...
@@ -461,17 +461,17 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
return
""
}
func
(
p
*
ControllerRegistor
)
geturl
(
t
*
Tree
,
url
,
controllName
,
methodName
string
,
params
map
[
string
]
string
)
(
bool
,
string
)
{
func
(
p
*
ControllerRegistor
)
geturl
(
t
*
Tree
,
url
,
controllName
,
methodName
string
,
params
map
[
string
]
string
,
httpMethod
string
)
(
bool
,
string
)
{
for
k
,
subtree
:=
range
t
.
fixrouters
{
u
:=
path
.
Join
(
url
,
k
)
ok
,
u
:=
p
.
geturl
(
subtree
,
u
,
controllName
,
methodName
,
params
)
ok
,
u
:=
p
.
geturl
(
subtree
,
u
,
controllName
,
methodName
,
params
,
httpMethod
)
if
ok
{
return
ok
,
u
}
}
if
t
.
wildcard
!=
nil
{
u
rl
=
path
.
Join
(
url
,
url_placeholder
)
ok
,
u
:=
p
.
geturl
(
t
.
wildcard
,
u
rl
,
controllName
,
methodName
,
params
)
u
:
=
path
.
Join
(
url
,
url_placeholder
)
ok
,
u
:=
p
.
geturl
(
t
.
wildcard
,
u
,
controllName
,
methodName
,
params
,
httpMethod
)
if
ok
{
return
ok
,
u
}
...
...
@@ -491,8 +491,8 @@ func (p *ControllerRegistor) geturl(t *Tree, url, controllName, methodName strin
}
}
if
!
find
{
for
_
,
md
:=
range
c
.
methods
{
if
md
==
methodName
{
for
m
,
md
:=
range
c
.
methods
{
if
(
m
==
"*"
||
m
==
httpMethod
)
&&
md
==
methodName
{
find
=
true
}
}
...
...
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