From 56d16d17923b5d4011155cdd025e050c9b4b45ae Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 31 Oct 2014 19:57:32 -0400 Subject: [PATCH] fix topic titles in search results titles were being escaped twice if two or more posts were from the same topic --- src/posts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/posts.js b/src/posts.js index a1d1b1a93a..7eac14c3d0 100644 --- a/src/posts.js +++ b/src/posts.js @@ -271,6 +271,9 @@ var async = require('async'), } var cids = topics.map(function(topic) { + if (topic) { + topic.title = validator.escape(topic.title); + } return topic && topic.cid; }).filter(function(value, index, array) { return value && array.indexOf(value) === index; @@ -320,9 +323,7 @@ var async = require('async'), async.map(posts, function(post, next) { post.user = results.users[post.uid]; post.topic = results.topics[post.tid]; - post.topic.title = validator.escape(post.topic.title); post.category = results.categories[post.topic.cid]; - post.relativeTime = utils.toISOString(post.timestamp); if (!post.content || !options.parse) {