mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
closing julianlam/nodebb-plugin-sso-oauth#8 -- if a templates directory is defined without that directory being present, NodeBB will no longer crash
This commit is contained in:
@@ -591,9 +591,13 @@ var fs = require('fs'),
|
|||||||
if (plugin.templates && plugin.id && plugin.active) {
|
if (plugin.templates && plugin.id && plugin.active) {
|
||||||
var templatesPath = path.join(__dirname, '../node_modules', plugin.id, plugin.templates);
|
var templatesPath = path.join(__dirname, '../node_modules', plugin.id, plugin.templates);
|
||||||
utils.walk(templatesPath, function(err, pluginTemplates) {
|
utils.walk(templatesPath, function(err, pluginTemplates) {
|
||||||
|
if (pluginTemplates) {
|
||||||
pluginTemplates.forEach(function(pluginTemplate) {
|
pluginTemplates.forEach(function(pluginTemplate) {
|
||||||
templates["/" + pluginTemplate.replace(templatesPath, '').substring(1)] = pluginTemplate;
|
templates["/" + pluginTemplate.replace(templatesPath, '').substring(1)] = pluginTemplate;
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
winston.warn('[plugins/' + plugin.id + '] A templates directory was defined for this plugin, but was not found.');
|
||||||
|
}
|
||||||
|
|
||||||
next(err);
|
next(err);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user