From 352f244d68a32db3785f1ddf6973a24f9bfe9f8f Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Wed, 16 Feb 2022 21:57:03 +0100 Subject: [PATCH] trim hash part from custom imagery source URLs before trying to detect the imagery source's type, fixes #8822 --- modules/renderer/background_source.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/renderer/background_source.js b/modules/renderer/background_source.js index 8546082ba..770dcc60d 100644 --- a/modules/renderer/background_source.js +++ b/modules/renderer/background_source.js @@ -112,19 +112,19 @@ export function rendererBackgroundSource(data) { source.url = function(coord) { - var result = _template; + var result = _template.replace(/#.*/su, ''); // strip hash part of URL if (result === '') return result; // source 'none' // Guess a type based on the tokens present in the template // (This is for 'custom' source, where we don't know) if (!source.type || source.id === 'custom') { - if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(_template)) { + if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) { source.type = 'wms'; source.projection = 'EPSG:3857'; // guess - } else if (/\{(x|y)\}/.test(_template)) { + } else if (/\{(x|y)\}/.test(result)) { source.type = 'tms'; - } else if (/\{u\}/.test(_template)) { + } else if (/\{u\}/.test(result)) { source.type = 'bing'; } }