Skip to content

Node.js based forum software built for the modern web

dont retry absolute paths

Barış Soner Uşaklıda22940b80f2
diff --git a/src/plugins/index.js b/src/plugins/index.js
index c5c101873c..5dae04c706 100644
--- a/src/plugins/index.js
+++ b/src/plugins/index.js
@@ -37,15 +37,20 @@ Plugins.languageData = {};
Plugins.initialized = false;
var defaultRequire = module.require;
-module.require = function () {
+
+module.require = function (p) {
try {
- return defaultRequire.apply(this, arguments);
+ return defaultRequire.apply(module, arguments);
} catch (err) {
// if we can't find the module try in parent directory
// since plugins.js moved into plugins folder
if (err.code === 'MODULE_NOT_FOUND') {
- winston.warn('[plugins/require] please update module.parent.require("' + arguments[0] + '") in your plugin!\n' + err.stack.split('\n')[5]);
- return defaultRequire.apply(this, [path.join('../', arguments[0])]);
+ winston.warn('[plugins/require] ' + err.message + ', please update your plugin!\n' + err.stack.split('\n')[5]);
+ if (path.isAbsolute(p)) {
+ throw err;
+ }
+
+ return defaultRequire.apply(module, [path.join('../', p)]);
}
throw err;
}