lib/db: Fix prefixed walks (fixes #4925) (#4940)

This commit is contained in:
Simon Frei
2018-05-17 09:26:40 +02:00
committed by Jakob Borg
parent 81f9a81c7d
commit d64d954721
5 changed files with 165 additions and 92 deletions

View File

@@ -2403,7 +2403,8 @@ func (m *Model) GlobalDirectoryTree(folder, prefix string, levels int, dirsonly
files.WithPrefixedGlobalTruncated(prefix, func(fi db.FileIntf) bool {
f := fi.(db.FileInfoTruncated)
if f.IsInvalid() || f.IsDeleted() || f.Name == prefix {
// Don't include the prefix itself.
if f.IsInvalid() || f.IsDeleted() || strings.HasPrefix(prefix, f.Name) {
return true
}