Browse Source

Add check for directories in files endpoint

Roman Zipp 3 years ago
committed by Fabian Vowie
parent
commit
913b20604c
No known key found for this signature in database GPG Key ID: C27317C33B27C410
  1. 8
      controllers/file.go

8
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()})
}
}

Loading…
Cancel
Save