missing encoder for tree
This commit is contained in:
+8
-2
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user