diff --git a/src/openlayers/mapping/WebMap.js b/src/openlayers/mapping/WebMap.js index d4cd28e76..e5a04e778 100644 --- a/src/openlayers/mapping/WebMap.js +++ b/src/openlayers/mapping/WebMap.js @@ -1115,12 +1115,9 @@ export class WebMap extends Observable { */ createDynamicTiledSource(layerInfo, isBaseLayer) { let serverType = "IPORTAL", - credential = layerInfo.credential, - keyfix = 'Token', + credential = layerInfo.credential ? layerInfo.credential.token : undefined, + keyfix = 'Token', keyParams = layerInfo.url; - if (credential && credential.token) { - credential = credential.token - } if (layerInfo.url.indexOf("www.supermapol.com") > -1 || layerInfo.url.indexOf("itest.supermapol.com") > -1) { keyfix = 'Key'; @@ -1393,12 +1390,13 @@ export class WebMap extends Observable { withCredentials: this.withCredentials, withoutFormatSuffix: true }; + let tempUrl = layerInfo.url; if (layerInfo.url.indexOf("?token=") > -1) { - that.credentialKey = 'token'; - that.credentialValue = layerInfo.credential = layerInfo.url.split("?token=")[1]; + layerInfo.credential = { token: layerInfo.url.split("?token=")[1] }; layerInfo.url = layerInfo.url.split("?token=")[0]; } - return FetchRequest.get(that.getRequestUrl(`${layerInfo.url}.json`), null, options).then(function (response) { + let url = this.handleJSONSuffix(tempUrl); + return FetchRequest.get(that.getRequestUrl(url), null, options).then(function (response) { return response.json(); }).then(async function (result) { // layerInfo.projection = mapInfo.projection; @@ -5162,4 +5160,16 @@ export class WebMap extends Observable { } return ['EPSG:-1000','EPSG:-1'].includes(projection); } + handleJSONSuffix(url) { + if(!url.includes('.json')) { + if (url.includes('?')) { + let urlArr = url.split('?'); + urlArr[0] = urlArr[0] + ".json"; + url = urlArr.join('?'); + } else { + url = url + ".json" + } + } + return url; + } }