Use array of path to avoid collisions and extract scale-factor param properly
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user