From 071d9718541ebe2a6e2994774ac32968349070d8 Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Fri, 6 Feb 2026 10:36:08 -0500 Subject: [PATCH] fix(storage): return empty array instead of null for file list Initialize files slice with make() to ensure JSON serialization returns [] instead of null when no files exist. Prevents frontend TypeError when calling .map() on null. --- backend/storage/storage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/storage/storage.go b/backend/storage/storage.go index a2eb9c1..3636c79 100644 --- a/backend/storage/storage.go +++ b/backend/storage/storage.go @@ -52,7 +52,7 @@ func (s *Storage) List() ([]string, error) { return nil, fmt.Errorf("failed to read data directory: %w", err) } - var files []string + files := make([]string, 0) for _, entry := range entries { if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".md") { files = append(files, strings.TrimSuffix(entry.Name(), ".md"))