mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
skip directory listing when paginating files.
This commit is contained in:
parent
4483732b2c
commit
3a024d62df
|
@ -31,6 +31,11 @@ func (fs *FilerServer) filerHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
fs.PostHandler(w, r)
|
fs.PostHandler(w, r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// listDirectoryHandler lists directories and folers under a directory
|
||||||
|
// files are sorted by name and paginated via "lastFileName" and "limit".
|
||||||
|
// sub directories are listed on the first page, when "lastFileName"
|
||||||
|
// is empty.
|
||||||
func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Request) {
|
func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if !strings.HasSuffix(r.URL.Path, "/") {
|
if !strings.HasSuffix(r.URL.Path, "/") {
|
||||||
return
|
return
|
||||||
|
@ -43,8 +48,10 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque
|
||||||
}
|
}
|
||||||
m := make(map[string]interface{})
|
m := make(map[string]interface{})
|
||||||
m["Directory"] = r.URL.Path
|
m["Directory"] = r.URL.Path
|
||||||
m["Subdirectories"] = dirlist
|
|
||||||
lastFileName := r.FormValue("lastFileName")
|
lastFileName := r.FormValue("lastFileName")
|
||||||
|
if lastFileName == "" {
|
||||||
|
m["Subdirectories"] = dirlist
|
||||||
|
}
|
||||||
limit, limit_err := strconv.Atoi(r.FormValue("limit"))
|
limit, limit_err := strconv.Atoi(r.FormValue("limit"))
|
||||||
if limit_err != nil {
|
if limit_err != nil {
|
||||||
limit = 100
|
limit = 100
|
||||||
|
|
Loading…
Reference in a new issue