diff options
| author | Chris Lu <chris.lu@gmail.com> | 2018-06-04 19:28:59 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2018-06-04 19:28:59 -0700 |
| commit | 95fe745a0cf98975172e5e8fc166647c48f52c80 (patch) | |
| tree | c0058624295036275ba88e0334cf469e37eb8758 | |
| parent | c546c309f10154688431433c031d62dc20edfc85 (diff) | |
| download | seaweedfs-95fe745a0cf98975172e5e8fc166647c48f52c80.tar.xz seaweedfs-95fe745a0cf98975172e5e8fc166647c48f52c80.zip | |
compatible with previous json rendering
| -rw-r--r-- | weed/server/filer_server_handlers_read_dir.go | 46 |
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, + }) } } |
