diff options
-rw-r--r-- | system/admin/handlers.go | 14 |
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)) } |