From 1e7adda054a6f70106c697fffd97fc5d47ee523b Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 6 Feb 2014 15:58:27 -0500 Subject: [PATCH] for #944 --- src/meta.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/meta.js b/src/meta.js index 3a1caec33a..7f1e496de7 100644 --- a/src/meta.js +++ b/src/meta.js @@ -251,14 +251,19 @@ var fs = require('fs'), var paths = jsPath.split('/'), mappedPath = paths[1]; - jsPath = jsPath.replace(path.join('plugins', mappedPath), ''); - return path.join(plugins.staticDirs[mappedPath], jsPath); + if (plugins.staticDirs[mappedPath]) { + jsPath = jsPath.replace(path.join('plugins', mappedPath), ''); + return path.join(plugins.staticDirs[mappedPath], jsPath); + } else { + winston.warn('[meta.scripts.get] Could not resolve mapped path: ' + mappedPath + '. Are you sure it is defined by a plugin?'); + return null; + } } else { return path.join(__dirname, '..', '/public', jsPath); } }); - Meta.js.scripts = jsPaths; + Meta.js.scripts = jsPaths.filter(function(path) { return path !== null }); if (process.env.NODE_ENV !== 'development') { async.parallel({