From 4323374a83993d73268026d09c326e86eebdefc1 Mon Sep 17 00:00:00 2001 From: Matt Brittan Date: Mon, 19 Jul 2021 22:16:16 +1200 Subject: [PATCH] Dont panic if there are files with short names in the file store folder. Replacement for PR 253 --- filestore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filestore.go b/filestore.go index a4bc1092..e1ef4814 100644 --- a/filestore.go +++ b/filestore.go @@ -168,7 +168,7 @@ func (store *FileStore) all() []string { for _, f := range files { DEBUG.Println(STR, "file in All():", f.Name()) name := f.Name() - if name[len(name)-4:] != msgExt { + if len(name) < len(msgExt) || name[len(name)-len(msgExt):] != msgExt { DEBUG.Println(STR, "skipping file, doesn't have right extension: ", name) continue }