validation middleware for layer route (conflicting route)

This commit is contained in:
Simon 2017-09-26 14:56:20 +02:00
parent 540fda1e6c
commit 3f6afb4530

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();
}