Fixed: Testing for a valid filename on a folder path causes plugins with views to fail to load associated views

Ryan Blenis committed Jul 8, 2020 at 20:18 UTC 222e8481d5ef2b82ae6fbd619f995898021854c9
1 file changed +4 -2
pluginHandler.js
+4 -2
@@ -518,7 +518,8 @@ module.exports.pluginHandler = function (parent) {
518 obj.handleAdminReq = function (req, res, user, serv) {
519 if ((req.query.pin == null) || (obj.common.isAlphaNumeric(req.query.pin) !== true)) { res.sendStatus(401); return; }
520 var path = obj.path.join(obj.pluginPath, req.query.pin, 'views');
521 - if (obj.common.IsFilenameValid(path) !== true) { res.sendStatus(401); return; }
521 + // path isn't a filename, it is a folder path
522 + //if (obj.common.IsFilenameValid(path) !== true) { res.sendStatus(401); return; }
523 serv.app.set('views', path);
524 if ((obj.plugins[req.query.pin] != null) && (typeof obj.plugins[req.query.pin].handleAdminReq == 'function')) {
525 obj.plugins[req.query.pin].handleAdminReq(req, res, user);
@@ -530,7 +531,8 @@ module.exports.pluginHandler = function (parent) {
531 obj.handleAdminPostReq = function (req, res, user, serv) {
532 if ((req.query.pin == null) || (obj.common.isAlphaNumeric(req.query.pin) !== true)) { res.sendStatus(401); return; }
533 var path = obj.path.join(obj.pluginPath, req.query.pin, 'views');
533 - if (obj.common.IsFilenameValid(path) !== true) { res.sendStatus(401); return; }
534 + // path isn't a filename, it is a folder path
535 + //if (obj.common.IsFilenameValid(path) !== true) { res.sendStatus(401); return; }
536 serv.app.set('views', path);
537 if ((obj.plugins[req.query.pin] != null) && (typeof obj.plugins[req.query.pin].handleAdminPostReq == 'function')) {
538 obj.plugins[req.query.pin].handleAdminPostReq(req, res, user);