/admin/plugins: Fix search algorithm (use string match in lower case)

fix #1903
pull/1904/head
Marcel Klehr 2013-09-23 19:55:35 +02:00
parent 7898c350f7
commit 6a02302fc9
1 changed files with 2 additions and 2 deletions

View File

@ -83,8 +83,8 @@ exports.search = function(searchTerm, maxCacheAge, cb) {
searchTerm = searchTerm.toLowerCase();
for (var pluginName in results) { // for every available plugin
if (pluginName.indexOf(plugins.prefix) != 0) continue; // TODO: Also search in keywords here!
if(searchTerm && pluginName.indexOf(searchTerm) < 0 && results[pluginName].description.indexOf(searchTerm) < 0) continue;
if(searchTerm && !~pluginName.toLowerCase().indexOf(searchTerm) && !~results[pluginName].description.toLowerCase().indexOf(searchTerm)) continue;
res[pluginName] = results[pluginName];
}
cb && cb(null, res)