fix: add 'sprite/' to generated path

So it doesn't conflict with style json url

Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
Andrew Calcutt 2024-04-20 15:18:23 -04:00 committed by acalcutt
parent eb978ad2f1
commit a5f3b1488a

View file

@ -56,7 +56,7 @@ export const serve_style = {
return res.send(styleJSON_); return res.send(styleJSON_);
}); });
app.get('/:id/:name:scale(@[23]x)?.:format([\\w]+)', (req, res, next) => { app.get('/:id/sprite/:name:scale(@[23]x)?.:format([\\w]+)', (req, res, next) => {
const item = repo[req.params.id]; const item = repo[req.params.id];
if (!item || !item.spritePaths) { if (!item || !item.spritePaths) {
@ -170,7 +170,7 @@ export const serve_style = {
path.relative(options.paths.sprites, path.dirname(styleFile)) path.relative(options.paths.sprites, path.dirname(styleFile))
) )
); );
spriteItem.url = `local://styles/${id}/` + spriteName; spriteItem.url = `local://styles/${id}/sprite/` + spriteName;
spritePaths.push({id: spriteItem.id, name: spriteName, path: spritePath}); spritePaths.push({id: spriteItem.id, name: spriteName, path: spritePath});
} }
}); });
@ -186,7 +186,7 @@ export const serve_style = {
path.relative(options.paths.sprites, path.dirname(styleFile)) path.relative(options.paths.sprites, path.dirname(styleFile))
) )
); );
styleJSON.sprite = `local://styles/${id}/` + spriteName; styleJSON.sprite = `local://styles/${id}/sprite/` + spriteName;
spritePaths.push({id: 'default', name: spriteName, path: spritePath}); spritePaths.push({id: 'default', name: spriteName, path: spritePath});
} }
} }