CesiumGS / cesium-native

Apache License 2.0
402 stars 205 forks source link

Add TMS trailing slash at end of path, rather than end of url. #850

Closed kring closed 4 months ago

kring commented 4 months ago

This is PR into #849, so merge that first.

TileMapServiceRasterOverlay attempts to add a / to the end of the URL it's given when that URL doesn't end in .xml and it doesn't already end in a slash. But the code was looking at the last character of the entire URL, rather than the last character of the path. So if the URL had query parameters, it didn't work at all.

kring commented 4 months ago

As we discussed offline, https://sandcastle.cesium.com/CesiumUnminified/Assets/Textures/NaturalEarthII/tilemapresource.xml?some=parameter should demonstrate the bug in that it will become https://sandcastle.cesium.com/CesiumUnminified/Assets/Textures/NaturalEarthII/tilemapresource.xml?some=parameter/ before this PR (note the trailing slash at the end). But because the sandcastle.cesium.com web server ignores that query parameter, it doesn't matter if there's an extra slash on the end of it or not, so nothing breaks. In my case the query parameter was an API key, so the extra slash made it invalid.

kring commented 4 months ago

I'll add a quick test for it, one moment... (mentioning it so you don't write that issue)