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.
This commit is contained in:
2026-02-06 10:36:08 -05:00
parent 773b9db4b2
commit 071d971854

View File

@@ -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"))