maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.24k stars 639 forks source link

style.json broken in 4.6.0 #1022

Closed ryan-shaw closed 1 year ago

ryan-shaw commented 1 year ago

Hi, in https://github.com/maptiler/tileserver-gl/blob/master/src/server.js#L540

the code has changed from

style.id = id;
style.name = (serving.styles[id] || serving.rendered[id]).name;
style.serving_data = serving.styles[id];
style.serving_rendered = serving.rendered[id];

to

return {
      id,
      name: (serving.styles[id] || serving.rendered[id]).name,
      serving_data: serving.styles[id],
      serving_rendered: serving.rendered[id],
      ...style,
    };

which means the id value in style is overriding the parms set id. I'm not sure if this is intentional or not but has broken our setup as the viewer template is now returning the wrong id and returning 404 for the style.json

ryan-shaw commented 1 year ago

Introduced in #1009

acalcutt commented 1 year ago

This was not intentional and if you have the code needed to revert I would appreciate a PR and I will make a patch version.

acalcutt commented 1 year ago

so at the end it appends style with ...style, which overrides the id set above?

ryan-shaw commented 1 year ago

Yes, I'm no nodejs dev but what I can see is id is contained in the style object but does not match the id above and the deconstructing of the object overwrites the id with an incorrect value

ryan-shaw commented 1 year ago

thank you for the quick release!

acalcutt commented 1 year ago

Did it fix your issue?

ryan-shaw commented 1 year ago

Haven't tried yet, will let you know when I have