Merge branch 'middlewarify' of github.com:CartoDB/Windshaft-cartodb into middlewarify

This commit is contained in:
Daniel García Aubert 2017-09-26 15:17:20 +02:00
commit de267917f4

View File

@ -71,6 +71,7 @@ LayergroupController.prototype.register = function(router) {
router.get(
'/:token/:layer/:z/:x/:y.(:format)',
validateLayerRouteMiddleware,
this.prepareContext,
this.layer.bind(this)
);
@ -249,9 +250,6 @@ LayergroupController.prototype.tile = function(req, res, next) {
// Gets a tile for a given token, layer set of tile ZXY coords. (OSM style)
LayergroupController.prototype.layer = function(req, res, next) {
if (req.params.token === 'static') {
return next();
}
req.profiler.start('windshaft.maplayer_tile');
this.tileOrLayer(req, res, next);
};
@ -462,3 +460,12 @@ LayergroupController.prototype.getAffectedTables = function(user, dbName, layerg
callback
);
};
function validateLayerRouteMiddleware(req, res, next) {
if (req.params.token === 'static') {
return next('route');
}
next();
}