Browse Source
Add check for directories in files endpoint
feature/add-get-files-endpoints
Roman Zipp
3 years ago
committed by
Fabian Vowie
No known key found for this signature in database
GPG Key ID: C27317C33B27C410
1 changed files with
8 additions and
0 deletions
-
controllers/file.go
|
@ -30,6 +30,10 @@ func FileHandler(w http.ResponseWriter, r *http.Request, pipes []pipelines.IPipe |
|
|
var files []File |
|
|
var files []File |
|
|
|
|
|
|
|
|
for _, b := range buckets { |
|
|
for _, b := range buckets { |
|
|
|
|
|
if b.IsDir() == false { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
bucketFiles, err := ioutil.ReadDir("./files/" + appSettings.StorageProvider.BasePath + "/" + b.Name()) |
|
|
bucketFiles, err := ioutil.ReadDir("./files/" + appSettings.StorageProvider.BasePath + "/" + b.Name()) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
writeError(w, 500, "Base path not found") |
|
|
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 { |
|
|
for _, f := range bucketFiles { |
|
|
|
|
|
if b.IsDir() == false { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
files = append(files, File{b.Name(), f.Name(), int(f.Size()), f.ModTime()}) |
|
|
files = append(files, File{b.Name(), f.Name(), int(f.Size()), f.ModTime()}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|