Commit 657e4bd
authored
fix: resolve relative style/tileset URLs for OGC vector tiles (#1641)
* fix: resolve relative style/tileset URLs for OGC vector tiles
Adding an Esri vector tile service through Add Data -> OGC Vector Tiles
added the layer and then rendered nothing, with no error anywhere.
Every Esri vector tile style declares its tileset relatively:
"sources": { "esri": { "type": "vector", "url": "../../" } }
`resolveOgcVectorTiles` copied that value straight into the MapLibre
source, and MapLibre resolves what it is handed against the *app* origin
rather than the document it came from -- so the source pointed at the
GeoLibre origin and never issued a single tile request. The `tiles`
form of a style source had the same flaw, as does an Esri
`VectorTileServer` document, which lists `tile/{z}/{y}/{x}.pbf`.
Resolve both forms against the document they were read from, and read
the tileset document behind a style's source URL so a non-TileJSON
service still yields usable absolute templates. `URL` percent-encodes
`{`/`}`, which would defeat MapLibre's placeholder substitution, so the
braces are restored after resolution.
Also surface Esri's HTTP 200 error bodies. ArcGIS reports a missing or
renamed service as 200 with `{"error":{"code":404,"message":...}}`, so
`response.ok` was true and the body parsed cleanly. That reached the
dialog as a valid-but-empty document and was reported as "no source
layers" -- hiding the real cause ("Requested Service not available.")
and sending the reporter looking for a nonexistent client problem.
Fixes #1639
* fix: surface ArcGIS error `details` when `message` is empty
ArcGIS routinely returns an error envelope whose `message` is an empty
string, with the only useful text in `details`. Asking a hosted
FeatureServer for a layer id it does not have answers:
{"code":400,"message":"","details":
["The requested layer (layerId: 0) was not found."]}
Both error paths read `message` alone and fell back to a generic string,
so the Add Data dialog said "ArcGIS service request failed." and dropped
the one line naming what to correct. Prefer `message`, then `details`,
then the fallback.
* Address review feedback
- Do not read `code: 0` as a failure in `assertNoServiceError`: zero
conventionally means success, so an envelope carrying only `code: 0`
would have rejected a perfectly good document.
- Recognize a string `code` (`{"error":{"code":"NotFound"}}`) as a
reported error. Only a numeric code counted before, so a host using
string codes with no `message` slipped through as an empty document —
the exact failure mode this check exists to catch.
- Add tests for the code-only branch (numeric 498 and a string code),
and for the shapes that must *not* trip it: `code: 0`, and an `error`
member that is a string, an array, or null.1 parent bbec6dd commit 657e4bd
5 files changed
Lines changed: 369 additions & 9 deletions
File tree
- apps/geolibre-desktop/src/lib
- packages/plugins/src/plugins
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
82 | 118 | | |
83 | 119 | | |
84 | 120 | | |
| |||
106 | 142 | | |
107 | 143 | | |
108 | 144 | | |
109 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
110 | 150 | | |
111 | 151 | | |
112 | 152 | | |
| |||
122 | 162 | | |
123 | 163 | | |
124 | 164 | | |
125 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
126 | 168 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
| |||
251 | 257 | | |
252 | 258 | | |
253 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
254 | 273 | | |
255 | 274 | | |
256 | 275 | | |
| |||
263 | 282 | | |
264 | 283 | | |
265 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
266 | 314 | | |
267 | 315 | | |
268 | 316 | | |
| |||
324 | 372 | | |
325 | 373 | | |
326 | 374 | | |
327 | | - | |
| 375 | + | |
| 376 | + | |
328 | 377 | | |
329 | 378 | | |
330 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
331 | 414 | | |
332 | | - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
333 | 418 | | |
334 | 419 | | |
335 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
256 | 285 | | |
257 | 286 | | |
258 | 287 | | |
| |||
281 | 310 | | |
282 | 311 | | |
283 | 312 | | |
284 | | - | |
| 313 | + | |
285 | 314 | | |
286 | 315 | | |
287 | 316 | | |
| |||
290 | 319 | | |
291 | 320 | | |
292 | 321 | | |
293 | | - | |
| 322 | + | |
294 | 323 | | |
295 | 324 | | |
296 | 325 | | |
| |||
378 | 407 | | |
379 | 408 | | |
380 | 409 | | |
381 | | - | |
| 410 | + | |
382 | 411 | | |
383 | 412 | | |
384 | | - | |
| 413 | + | |
385 | 414 | | |
386 | 415 | | |
387 | 416 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
152 | 178 | | |
153 | 179 | | |
154 | 180 | | |
| |||
0 commit comments