From 56495522b8a23d96db22789dd654ec6d032ee3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Wed, 18 Apr 2018 18:52:09 +0200 Subject: [PATCH] Use array of path to avoid collisions and extract scale-factor param properly --- .../api/map/tile-layergroup-controller.js | 32 ++----------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/lib/cartodb/api/map/tile-layergroup-controller.js b/lib/cartodb/api/map/tile-layergroup-controller.js index c79929b7..2c049019 100644 --- a/lib/cartodb/api/map/tile-layergroup-controller.js +++ b/lib/cartodb/api/map/tile-layergroup-controller.js @@ -42,13 +42,11 @@ module.exports = class TileLayergroupController { } register (mapRouter) { - // REGEXP matches with positive and negative numnbers - const number = () => `(-?\\d+)`; // REGEXP doesn't match with `val` const not = (val) => `(?!${val})([^\/]+?)`; mapRouter.get( - `/:token/:z${number()}/:x${number()}/:y${number()}@:scale_factor${number()}?x.:format`, + [ `/:token/:z/:x/:y@:scale_factor?x.:format`, `/:token/:z/:x/:y.:format` ], layergroupToken(), coordinates(), credentials(), @@ -74,33 +72,7 @@ module.exports = class TileLayergroupController { ); mapRouter.get( - `/:token/:z${number()}/:x${number()}/:y${number()}.:format`, - layergroupToken(), - coordinates(), - credentials(), - authorize(this.authBackend), - dbConnSetup(this.pgConnection), - rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.TILE), - cleanUpQueryParams(), - createMapStoreMapConfigProvider( - this.mapStore, - this.userLimitsBackend, - this.pgConnection, - this.layergroupAffectedTablesCache - ), - getTile(this.tileBackend, 'map_tile'), - cacheControlHeader(), - cacheChannelHeader(), - surrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }), - lastModifiedHeader(), - incrementSuccessMetrics(global.statsClient), - incrementErrorMetrics(global.statsClient), - tileError(), - vectorError() - ); - - mapRouter.get( - `/:token${not('static')}/:layer/:z${number()}/:x${number()}/:y${number()}.(:format)`, + `/:token${not('static')}/:layer/:z/:x/:y.(:format)`, layergroupToken(), coordinates(), credentials(),