Skip to content

Node.js based forum software built for the modern web

some checks for handling plugin deletion

Julian Lam216ff0f3f9b8
diff --git a/src/plugins.js b/src/plugins.js
index 93806a8a9a..8da34ebfe2 100644
--- a/src/plugins.js
+++ b/src/plugins.js
@@ -375,11 +375,15 @@ var fs = require('fs'),
dirs = dirs.map(function(file) {
return path.join(npmPluginPath, file);
}).filter(function(file) {
- var stats = fs.statSync(file),
- isPlugin = file.substr(npmPluginPath.length + 1, 14) === 'nodebb-plugin-' || file.substr(npmPluginPath.length + 1, 14) === 'nodebb-widget-';
+ if (fs.existsSync(file)) {
+ var stats = fs.statSync(file),
+ isPlugin = file.substr(npmPluginPath.length + 1, 14) === 'nodebb-plugin-' || file.substr(npmPluginPath.length + 1, 14) === 'nodebb-widget-';
- if (stats.isDirectory() && isPlugin) return true;
- else return false;
+ if (stats.isDirectory() && isPlugin) return true;
+ else return false;
+ } else {
+ return false;
+ }
});
next(err, dirs);