summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-10-18 22:57:22 -0700
committerSteve Manuel <nilslice@gmail.com>2016-10-18 22:57:22 -0700
commit71ce4cff96a22625d81604fdb2a3507018811187 (patch)
tree06542c5d7e6d09dbe41491a27b3df62050912dcc
parent430eb465773057a263f8e37ea1977a1425b3f574 (diff)
updating search results to reflect new admin list item for posts
-rw-r--r--system/admin/handlers.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index 3d20ac3..ecb96b4 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -694,10 +694,16 @@ func searchHandler(res http.ResponseWriter, req *http.Request) {
continue
}
- json.Unmarshal(posts[i], &p)
- post := `<li class="col s12"><a href="/admin/edit?type=` +
- t + `&id=` + fmt.Sprintf("%d", p.ContentID()) +
- `">` + p.ContentName() + `</a></li>`
+ err := json.Unmarshal(posts[i], &p)
+ if err != nil {
+ log.Println("Error unmarshal search result json into", t, err, posts[i])
+
+ post := `<li class="col s12">Error decoding data. Possible file corruption.</li>`
+ b.Write([]byte(post))
+ continue
+ }
+
+ post := adminPostListItem(p, t)
b.Write([]byte(post))
}