From ab0916af66d671f690d876dce85b1dea0957c79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bl=C3=A4sta?= Date: Wed, 11 Oct 2023 10:58:16 +0200 Subject: [PATCH 1/2] fix: bad url for icon in print legend --- src/controls/print/print-legend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controls/print/print-legend.js b/src/controls/print/print-legend.js index 9e89f098b..af0edf42f 100644 --- a/src/controls/print/print-legend.js +++ b/src/controls/print/print-legend.js @@ -61,7 +61,7 @@ const LayerRow = function LayerRow(options) { const layerName = aLayer.get('name'); const style = viewer.getStyle(aLayer.get('styleName')); if (style && style[0] && style[0][0] && style[0][0].icon) { - return `${style[0][0].icon.src}&format=${format}`; + return `${style[0][0].icon.src}?format=${format}`; } return `${url}?SERVICE=WMS&layer=${layerName}&format=${format}&version=1.1.1&request=getLegendGraphic&scale=401&legend_options=dpi:300`; }; From 891cc4ed05ad51e126f5202690a88ead66c0c433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bl=C3=A4sta?= Date: Wed, 11 Oct 2023 11:48:57 +0200 Subject: [PATCH 2/2] check for ? --- src/controls/print/print-legend.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/controls/print/print-legend.js b/src/controls/print/print-legend.js index af0edf42f..3a64430f4 100644 --- a/src/controls/print/print-legend.js +++ b/src/controls/print/print-legend.js @@ -61,6 +61,9 @@ const LayerRow = function LayerRow(options) { const layerName = aLayer.get('name'); const style = viewer.getStyle(aLayer.get('styleName')); if (style && style[0] && style[0][0] && style[0][0].icon) { + if (style[0][0].icon.src.includes('?')) { + return `${style[0][0].icon.src}&format=${format}`; + } return `${style[0][0].icon.src}?format=${format}`; } return `${url}?SERVICE=WMS&layer=${layerName}&format=${format}&version=1.1.1&request=getLegendGraphic&scale=401&legend_options=dpi:300`;