From afc608fc5da5576443ce092a9949c867eb1ff52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 22 Mar 2018 18:57:26 +0100 Subject: [PATCH] Pass only needed params to named map map config provider --- lib/cartodb/controllers/map.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/cartodb/controllers/map.js b/lib/cartodb/controllers/map.js index cdb1515f..192479e2 100644 --- a/lib/cartodb/controllers/map.js +++ b/lib/cartodb/controllers/map.js @@ -242,7 +242,11 @@ function getTemplate ( ) { return function getTemplateMiddleware (req, res, next) { const templateParams = req.body; - const { user } = res.locals; + const { user, dbuser, dbname, dbpassword, dbhost, dbport } = res.locals; + const { template_id } = req.params; + const { auth_token } = req.query; + + const params = { dbuser, dbname, dbpassword, dbhost, dbport }; const mapConfigProvider = new NamedMapMapConfigProvider( templateMaps, @@ -252,10 +256,10 @@ function getTemplate ( mapConfigAdapter, affectedTablesCache, user, - req.params.template_id, + template_id, templateParams, - res.locals.auth_token, - res.locals + auth_token, + params ); mapConfigProvider.getMapConfig((err, mapConfig, rendererParams) => {