diff --git a/src/serve_rendered.js b/src/serve_rendered.js index 3e5c94eaa..055047c38 100644 --- a/src/serve_rendered.js +++ b/src/serve_rendered.js @@ -855,7 +855,7 @@ export const serve_rendered = { ); } - app.get('/(:tileSize(256|512)/)?:id.json', (req, res, next) => { + app.get('/(:tileSize(256|512)/)?:id([^/]+).json', (req, res, next) => { const item = repo[req.params.id]; if (!item) { return res.sendStatus(404); diff --git a/test/static.js b/test/static.js index 32bd80c77..e949720f9 100644 --- a/test/static.js +++ b/test/static.js @@ -123,14 +123,16 @@ describe('Static endpoints', function () { }); describe('different parameters', function () { - testStatic(prefix, '-180,-90,180,90/20x20', 'png', 200, 2); + testStatic(prefix, '-180,-80,0,80/280x160', 'png', 200); + testStatic(prefix, '-180,-80,180,80/20x20', 'png', 200, 2); testStatic(prefix, '0,0,1,1/200x200', 'png', 200, 3); - - testStatic(prefix, '-280,-80,0,80/280x160', 'png', 200); }); }); describe('invalid requests return 4xx', function () { + //invalid center + testStatic(prefix, '-280,-80,0,80/280x160', 'png', 400); + testStatic(prefix, '-180,-90,180,90/20x20', 'png', 400, 2); testStatic(prefix, '0,87,1,88/5x2', 'png', 400); testStatic(prefix, '0,0,1,1/1x1', 'gif', 400);