Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
ae52d4aa
Commit
ae52d4aa
authored
Dec 17, 2015
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve the splitPath
parent
e5096be3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
tree.go
tree.go
+14
-2
No files found.
tree.go
View file @
ae52d4aa
...
@@ -354,10 +354,22 @@ func (t *Tree) match(pattern string, wildcardValues []string, ctx *context.Conte
...
@@ -354,10 +354,22 @@ func (t *Tree) match(pattern string, wildcardValues []string, ctx *context.Conte
}
}
if
runObject
==
nil
{
if
runObject
==
nil
{
segments
:=
splitPath
(
pattern
)
wildcardValues
=
append
(
wildcardValues
,
seg
)
wildcardValues
=
append
(
wildcardValues
,
seg
)
start
,
i
:=
0
,
0
for
;
i
<
len
(
pattern
);
i
++
{
if
pattern
[
i
]
==
'/'
{
if
i
!=
0
&&
start
<
len
(
pattern
)
{
wildcardValues
=
append
(
wildcardValues
,
pattern
[
start
:
i
])
}
start
=
i
+
1
continue
}
}
if
start
>
0
{
wildcardValues
=
append
(
wildcardValues
,
pattern
[
start
:
i
])
}
for
_
,
l
:=
range
t
.
leaves
{
for
_
,
l
:=
range
t
.
leaves
{
if
ok
:=
l
.
match
(
append
(
wildcardValues
,
segments
...
)
,
ctx
);
ok
{
if
ok
:=
l
.
match
(
wildcardValues
,
ctx
);
ok
{
return
l
.
runObject
return
l
.
runObject
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment