From 539a3c46bc3dd3084a7f841d4f013ac1f0bad77a Mon Sep 17 00:00:00 2001 From: Umputun Date: Sun, 7 Jan 2018 19:47:34 -0600 Subject: [PATCH] missing encoder for tree --- app/rest/server.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/rest/server.go b/app/rest/server.go index 0590e734..b386c12f 100644 --- a/app/rest/server.go +++ b/app/rest/server.go @@ -240,8 +240,14 @@ func (s *Server) findCommentsCtrl(w http.ResponseWriter, r *http.Request) { if r.URL.Query().Get("format") == "tree" { treeComments := format.MakeTree(comments, r.URL.Query().Get("sort")) - s.respCache.Set(cacheKey, treeComments, time.Hour) - renderJSONWithHTML(w, r, treeComments) + + b, err := encodeJSONWithHTML(treeComments) + if err != nil { + common.SendErrorJSON(w, r, http.StatusInternalServerError, err, "can't encode comments") + return + } + s.respCache.Set(cacheKey, b, time.Hour) + renderJSONFromBytes(w, r, b) return }