Skip to content

Commit

Permalink
fix bug rjeczalik#148
Browse files Browse the repository at this point in the history
  • Loading branch information
lzp9421 committed Oct 16, 2022
1 parent 3472d85 commit f079f99
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,13 @@ func (nd node) WalkPath(name string, fn walkPathFunc) error {
default:
return err
}
if nd, ok = nd.Child[name[i:i+j]]; !ok {
return errnotexist(name[:i+j])
var snd node
if snd, ok = nd.Child[name[i:i+j]]; !ok {
if snd, ok = nd.Child[""]; !ok {
return errnotexist(name[:i+j])
}
}
nd = snd
i += j + 1
}
switch err := fn(nd, false); err {
Expand All @@ -192,9 +196,14 @@ func (nd node) WalkPath(name string, fn walkPathFunc) error {
default:
return err
}
if nd, ok = nd.Child[name[i:]]; !ok {
return errnotexist(name)
var snd node
if snd, ok = nd.Child[name[i:]]; !ok {
if snd, ok = nd.Child[""]; !ok {
return errnotexist(name)
}
}
nd = snd

switch err := fn(nd, true); err {
case nil, errSkip:
return nil
Expand Down

0 comments on commit f079f99

Please sign in to comment.