aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-06-04 19:28:59 -0700
committerChris Lu <chris.lu@gmail.com>2018-06-04 19:28:59 -0700
commit95fe745a0cf98975172e5e8fc166647c48f52c80 (patch)
treec0058624295036275ba88e0334cf469e37eb8758
parentc546c309f10154688431433c031d62dc20edfc85 (diff)
downloadseaweedfs-95fe745a0cf98975172e5e8fc166647c48f52c80.tar.xz
seaweedfs-95fe745a0cf98975172e5e8fc166647c48f52c80.zip
compatible with previous json rendering
-rw-r--r--weed/server/filer_server_handlers_read_dir.go46
1 files changed, 28 insertions, 18 deletions
diff --git a/weed/server/filer_server_handlers_read_dir.go b/weed/server/filer_server_handlers_read_dir.go
index a39fed3fd..e0c465461 100644
--- a/weed/server/filer_server_handlers_read_dir.go
+++ b/weed/server/filer_server_handlers_read_dir.go
@@ -46,25 +46,35 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque
glog.V(4).Infof("listDirectory %s, last file %s, limit %d: %d items", path, lastFileName, limit, len(entries))
- args := struct {
- Path string
- Breadcrumbs []ui.Breadcrumb
- Entries interface{}
- Limit int
- LastFileName string
- ShouldDisplayLoadMore bool
- }{
- path,
- ui.ToBreadcrumb(path),
- entries,
- limit,
- lastFileName,
- shouldDisplayLoadMore,
- }
-
if r.Header.Get("Accept") == "application/json" {
- writeJsonQuiet(w, r, http.StatusOK, args)
+ writeJsonQuiet(w, r, http.StatusOK, struct {
+ Path string
+ Entries interface{}
+ Limit int
+ LastFileName string
+ ShouldDisplayLoadMore bool
+ }{
+ path,
+ entries,
+ limit,
+ lastFileName,
+ shouldDisplayLoadMore,
+ })
} else {
- ui.StatusTpl.Execute(w, args)
+ ui.StatusTpl.Execute(w, struct {
+ Path string
+ Breadcrumbs []ui.Breadcrumb
+ Entries interface{}
+ Limit int
+ LastFileName string
+ ShouldDisplayLoadMore bool
+ }{
+ path,
+ ui.ToBreadcrumb(path),
+ entries,
+ limit,
+ lastFileName,
+ shouldDisplayLoadMore,
+ })
}
}