Merge pull request #1882 from fviard/develop
Fix to check if searchTerm is not "undefined" before trying to use it to...pull/1883/head
commit
8073c62de3
|
@ -79,10 +79,12 @@ exports.search = function(searchTerm, maxCacheAge, cb) {
|
|||
exports.getAvailablePlugins(maxCacheAge, function(er, results) {
|
||||
if(er) return cb && cb(er);
|
||||
var res = {};
|
||||
searchTerm = searchTerm.toLowerCase();
|
||||
if (searchTerm)
|
||||
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(pluginName.indexOf(searchTerm) < 0 && results[pluginName].description.indexOf(searchTerm) < 0) continue;
|
||||
|
||||
if(searchTerm && pluginName.indexOf(searchTerm) < 0 && results[pluginName].description.indexOf(searchTerm) < 0) continue;
|
||||
res[pluginName] = results[pluginName];
|
||||
}
|
||||
cb && cb(null, res)
|
||||
|
|
Loading…
Reference in New Issue