fs/torrentfs.go | 3 +++ fs/torrentfs_test.go | 1 + diff --git a/fs/torrentfs.go b/fs/torrentfs.go index 0f1cc9e6c7244b45b12ae02800e32cb4babf83b2..55834a241379e4a07d9aa3e8ca45590d6984e525 100644 --- a/fs/torrentfs.go +++ b/fs/torrentfs.go @@ -158,6 +158,9 @@ _ fusefs.HandleReader = fileNode{} ) func isSubPath(parent, child string) bool { + if len(parent) == 0 { + return len(child) > 0 + } if !strings.HasPrefix(child, parent) { return false } diff --git a/fs/torrentfs_test.go b/fs/torrentfs_test.go index da83a75b391c2fd8ee88a509414e7c33ad365937..f3564124d724ada75df60b285b7143b0b757242d 100644 --- a/fs/torrentfs_test.go +++ b/fs/torrentfs_test.go @@ -214,6 +214,7 @@ is bool }{ {"", "", false}, {"", "/", true}, + {"", "a", true}, {"a/b", "a/bc", false}, {"a/b", "a/b", false}, {"a/b", "a/b/c", true},