From b57dbc37cd8914cf177f1c9c1b0061423deb8ce5 Mon Sep 17 00:00:00 2001 From: dhingey Date: Thu, 5 Jun 2014 23:12:46 -0700 Subject: [PATCH] Fix relative path URL bugs in the plugin API. Fixes plugin-related 404 URLs, as well as the plugin directory URL for installations which use a relative path. --- src/routes/plugins.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/plugins.js b/src/routes/plugins.js index 334ad3fbbf..bcff6bf352 100644 --- a/src/routes/plugins.js +++ b/src/routes/plugins.js @@ -15,7 +15,7 @@ var _ = require('underscore'), module.exports = function(app, middleware, controllers) { // Static Assets app.get('/plugins/:id/*', function(req, res) { - var relPath = req._parsedUrl.pathname.replace(nconf.get('relative_path') + '/plugins/', ''), + var relPath = req._parsedUrl.pathname.replace('/plugins/', ''), matches = _.map(plugins.staticDirs, function(realPath, mappedPath) { if (relPath.match(mappedPath)) { return mappedPath; @@ -44,11 +44,11 @@ module.exports = function(app, middleware, controllers) { if (matches.length) { res.sendfile(matches[0]); } else { - res.redirect('/404'); + res.redirect(nconf.get('relative_path') + '/404'); } }); } else { - res.redirect('/404'); + res.redirect(nconf.get('relative_path') + '/404'); } }); };