Skip to content

Commit

Permalink
Improved validation of ESRI services before adding map layer (#3321)
Browse files Browse the repository at this point in the history
* Validate  ESRI service supports 'Map' requests before making further tile requests.

* changelog
  • Loading branch information
mdastous-bentley authored Mar 9, 2022
1 parent 935bc6e commit 9072a11
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-frontend",
"comment": "Improved validation of ESRI services before adding map layer",
"type": "none"
}
],
"packageName": "@itwin/core-frontend"
}
13 changes: 13 additions & 0 deletions core/frontend/src/tile/map/ArcGisUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,19 @@ export class ArcGisUtilities {
return { status: MapLayerSourceStatus.InvalidCredentials, authInfo: { authMethod: MapLayerAuthType.EsriToken } };
}

// Check this service support map queries
let hasMapCapability = false;
try {
if (json.capabilities
&& typeof json.capabilities === "string"
&& json.capabilities.toLowerCase().includes("map")) {
hasMapCapability = true;
}
} catch { }
if (!hasMapCapability) {
return { status: MapLayerSourceStatus.InvalidFormat};
}

let subLayers;
if (json.layers) {

Expand Down

0 comments on commit 9072a11

Please sign in to comment.