From 913b20604cc772667cdf6f9ba398a0915cb5df8a Mon Sep 17 00:00:00 2001 From: Roman Zipp Date: Mon, 14 Feb 2022 15:09:38 +0100 Subject: [PATCH] Add check for directories in files endpoint --- controllers/file.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/controllers/file.go b/controllers/file.go index 0552f20..5e1525b 100644 --- a/controllers/file.go +++ b/controllers/file.go @@ -27,6 +27,10 @@ func FileHandler(w http.ResponseWriter, r *http.Request, pipes []pipelines.IPipe var files []File for _, b := range buckets { + if b.IsDir() == false { + continue + } + bucketFiles, err := ioutil.ReadDir("./files/" + appSettings.StorageProvider.BasePath + "/" + b.Name()) if err != nil { writeError(w, 500, "Base path not found") @@ -34,6 +38,10 @@ func FileHandler(w http.ResponseWriter, r *http.Request, pipes []pipelines.IPipe } for _, f := range bucketFiles { + if b.IsDir() == false { + continue + } + files = append(files, File{b.Name(), f.Name(), int(f.Size()), f.ModTime()}) } }