Skip to content

Commit 9072a11

Browse files
Improved validation of ESRI services before adding map layer (#3321)
* Validate ESRI service supports 'Map' requests before making further tile requests. * changelog
1 parent 935bc6e commit 9072a11

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/core-frontend",
5+
"comment": "Improved validation of ESRI services before adding map layer",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/core-frontend"
10+
}

core/frontend/src/tile/map/ArcGisUtilities.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,19 @@ export class ArcGisUtilities {
140140
return { status: MapLayerSourceStatus.InvalidCredentials, authInfo: { authMethod: MapLayerAuthType.EsriToken } };
141141
}
142142

143+
// Check this service support map queries
144+
let hasMapCapability = false;
145+
try {
146+
if (json.capabilities
147+
&& typeof json.capabilities === "string"
148+
&& json.capabilities.toLowerCase().includes("map")) {
149+
hasMapCapability = true;
150+
}
151+
} catch { }
152+
if (!hasMapCapability) {
153+
return { status: MapLayerSourceStatus.InvalidFormat};
154+
}
155+
143156
let subLayers;
144157
if (json.layers) {
145158

0 commit comments

Comments
 (0)