qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.55k stars 2.99k forks source link

WMS GetLegendGraphic not escaping request correctly #53564

Open rphenriques opened 1 year ago

rphenriques commented 1 year ago

What is the bug or the crash?

When using WMS layers with characters in names that need to be escaped in HTTP request, the legend does not display.

Steps to reproduce the issue

When using the layer https://sig.lneg.pt/server/rest/services/AtlasEolico/MapServer/10 the legend URL is https://sig.lneg.pt/server/services/AtlasEolico/MapServer/WmsServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=Fluxo de potência incidente 20m [W/m2] which does not render unless it is escaped to https://sig.lneg.pt/server/services/AtlasEolico/MapServer/WmsServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=Fluxo%20de%20pot%C3%AAncia%20incidente%2020m%20%5BW/m2%5D

this is not the case when using the layer ZZZZ on the same server. In this case the announced URL is https://sig.lneg.pt/server/services/AtlasEolico/MapServer/WmsServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=Factor de forma de Weibull 20m and it displays correctly

The noticeable difference in the name is the use of the [ ] characters in the name of the layer that is not working. When this characters were escaped, the legend displays.

Versions

QGIS version 3.28.3-Firenze QGIS code revision 9ae208a46d
Qt version 5.15.2
Python version 3.9.5
GDAL/OGR version 3.3.2
PROJ version 8.1.1
EPSG Registry database version v10.028 (2021-07-07)
GEOS version 3.9.1-CAPI-1.14.2
SQLite version 3.35.2
PDAL version 2.3.0
PostgreSQL client version unknown
SpatiaLite version 5.0.1
QWT version 6.1.6
QScintilla2 version 2.11.5
OS version macOS 13.4
       

Active Python plugins DotMap | 0.2 quick_map_services | 0.19.33 ntv2_transformations | 0.20 pstimeseries | 0.3.1 postgis_geoprocessing | 0.9 downloadgeostatportugal | 0.2 Mergin | 2023.1 processing | 2.12.99 sagaprovider | 2.12.99 grassprovider | 2.12.99 db_manager | 0.1.20 MetaSearch | 0.3.6

QGIS version 3.28.3-Firenze QGIS code revision 9ae208a46d Qt version 5.15.2 Python version 3.9.5 GDAL/OGR version 3.3.2 PROJ version 8.1.1 EPSG Registry database version v10.028 (2021-07-07) GEOS version 3.9.1-CAPI-1.14.2 SQLite version 3.35.2 PDAL version 2.3.0 PostgreSQL client version unknown SpatiaLite version 5.0.1 QWT version 6.1.6 QScintilla2 version 2.11.5 OS version macOS 13.4

Active Python plugins DotMap 0.2 quick_map_services 0.19.33 ntv2_transformations 0.20 pstimeseries 0.3.1 postgis_geoprocessing 0.9 downloadgeostatportugal 0.2 Mergin 2023.1 processing 2.12.99 sagaprovider 2.12.99 grassprovider 2.12.99 db_manager 0.1.20 MetaSearch 0.3.6

Supported QGIS version

New profile

Additional context

No response

pathmapper commented 1 year ago

Confirmed, GetCapabilities: https://sig.lneg.pt/server/services/AtlasEolico/MapServer/WmsServer?request=GetCapabilities%26version=1.3.0%26service=WMS