lib/db: Don't panic on unknown folder in ListFolders (fixes #3584)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3869
This commit is contained in:
Jakob Borg
2017-01-04 10:34:52 +00:00
committed by Audrius Butkevicius
parent 2ebd6ad77f
commit 920274bce4
2 changed files with 16 additions and 12 deletions

View File

@@ -45,7 +45,10 @@ func TestGlobalKey(t *testing.T) {
key := db.globalKey(fld, name)
fld2 := db.globalKeyFolder(key)
fld2, ok := db.globalKeyFolder(key)
if !ok {
t.Error("should have been found")
}
if !bytes.Equal(fld2, fld) {
t.Errorf("wrong folder %q != %q", fld2, fld)
}
@@ -53,4 +56,9 @@ func TestGlobalKey(t *testing.T) {
if !bytes.Equal(name2, name) {
t.Errorf("wrong name %q != %q", name2, name)
}
_, ok = db.globalKeyFolder([]byte{1, 2, 3, 4, 5})
if ok {
t.Error("should not have been found")
}
}