fs: fix isSubPath for top-level directories (#105)
This commit is contained in:
parent
00f406753a
commit
39cf5a7fde
|
@ -158,6 +158,9 @@ var (
|
|||
)
|
||||
|
||||
func isSubPath(parent, child string) bool {
|
||||
if len(parent) == 0 {
|
||||
return len(child) > 0
|
||||
}
|
||||
if !strings.HasPrefix(child, parent) {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -214,6 +214,7 @@ func TestIsSubPath(t *testing.T) {
|
|||
}{
|
||||
{"", "", false},
|
||||
{"", "/", true},
|
||||
{"", "a", true},
|
||||
{"a/b", "a/bc", false},
|
||||
{"a/b", "a/b", false},
|
||||
{"a/b", "a/b/c", true},
|
||||
|
|
Loading…
Reference in New Issue