Browse Source

Add check for directories in files endpoint

feature/add-get-files-endpoints
Roman Zipp 3 years ago
committed by Fabian Vowie
parent
commit
315c9adfca
No known key found for this signature in database GPG Key ID: C27317C33B27C410
  1. 8
      controllers/file.go

8
controllers/file.go

@ -30,6 +30,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")
@ -37,6 +41,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