mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 07:26:13 +02:00
Merge pull request #2397 from joe1chen/bug-fix-topic-search
Bug fix - Topic search broken due to encodeURIComponent being called too early
This commit is contained in:
@@ -7,17 +7,18 @@ define('search', ['navigator'], function(nav) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Search.query = function(term, callback) {
|
Search.query = function(term, callback) {
|
||||||
try {
|
|
||||||
term = encodeURIComponent(term);
|
|
||||||
} catch(e) {
|
|
||||||
return app.alertError('[[error:invalid-search-term]]');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detect if a tid was specified
|
// Detect if a tid was specified
|
||||||
var topicSearch = term.match(/in:topic-([\d]+)/);
|
var topicSearch = term.match(/in:topic-([\d]+)/);
|
||||||
|
|
||||||
if (!topicSearch) {
|
if (!topicSearch) {
|
||||||
term = term.replace(/^[ ?#]*/, '');
|
term = term.replace(/^[ ?#]*/, '');
|
||||||
|
|
||||||
|
try {
|
||||||
|
term = encodeURIComponent(term);
|
||||||
|
} catch(e) {
|
||||||
|
return app.alertError('[[error:invalid-search-term]]');
|
||||||
|
}
|
||||||
|
|
||||||
ajaxify.go('search/' + term);
|
ajaxify.go('search/' + term);
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user