From f02fd88eaf0f76d0cbed7bf06a0518ad47a444dd Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Tue, 11 Nov 2014 22:50:45 -0800 Subject: [PATCH] Bug fix - Topic search broken due to encodeURIComponent being called too early. --- public/src/modules/search.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/public/src/modules/search.js b/public/src/modules/search.js index 177e532c38..9059c58165 100644 --- a/public/src/modules/search.js +++ b/public/src/modules/search.js @@ -7,17 +7,18 @@ define('search', ['navigator'], function(nav) { }; Search.query = function(term, callback) { - try { - term = encodeURIComponent(term); - } catch(e) { - return app.alertError('[[error:invalid-search-term]]'); - } - // Detect if a tid was specified var topicSearch = term.match(/in:topic-([\d]+)/); if (!topicSearch) { term = term.replace(/^[ ?#]*/, ''); + + try { + term = encodeURIComponent(term); + } catch(e) { + return app.alertError('[[error:invalid-search-term]]'); + } + ajaxify.go('search/' + term); callback(); } else {