Skip to content

Commit 9bdfa67

Browse files
rduivenvoordem-kuhn
authored andcommitted
WMS GetLegendGraphic fix #15055
See http://hub.qgis.org/issues/15055 When creating the legend image url, this tests for available queryparams in a case-insensitive way...
1 parent a5392fb commit 9bdfa67

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/providers/wms/qgswmsprovider.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2952,19 +2952,25 @@ QUrl QgsWmsProvider::getLegendGraphicFullURL( double scale, const QgsRectangle&
29522952

29532953
QUrl url( lurl );
29542954

2955-
if ( !url.hasQueryItem( "SERVICE" ) )
2955+
// query names are NOT case-sensitive, so make an uppercase list for proper comparison
2956+
QStringList qnames = QStringList();
2957+
for ( int i = 0; i < url.queryItems().size(); i++ )
2958+
{
2959+
qnames << url.queryItems().at( i ).first.toUpper();
2960+
}
2961+
if ( !qnames.contains( "SERVICE" ) )
29562962
setQueryItem( url, "SERVICE", "WMS" );
2957-
if ( !url.hasQueryItem( "VERSION" ) )
2963+
if ( !qnames.contains( "VERSION" ) )
29582964
setQueryItem( url, "VERSION", mCaps.mCapabilities.version );
2959-
if ( !url.hasQueryItem( "SLD_VERSION" ) )
2965+
if ( !qnames.contains( "SLD_VERSION" ) )
29602966
setQueryItem( url, "SLD_VERSION", "1.1.0" ); // can not determine SLD_VERSION
2961-
if ( !url.hasQueryItem( "REQUEST" ) )
2967+
if ( !qnames.contains( "REQUEST" ) )
29622968
setQueryItem( url, "REQUEST", "GetLegendGraphic" );
2963-
if ( !url.hasQueryItem( "FORMAT" ) )
2969+
if ( !qnames.contains( "FORMAT" ) )
29642970
setFormatQueryItem( url );
2965-
if ( !url.hasQueryItem( "LAYER" ) )
2971+
if ( !qnames.contains( "LAYER" ) )
29662972
setQueryItem( url, "LAYER", mSettings.mActiveSubLayers[0] );
2967-
if ( !url.hasQueryItem( "STYLE" ) )
2973+
if ( !qnames.contains( "STYLE" ) )
29682974
setQueryItem( url, "STYLE", mSettings.mActiveSubStyles[0] );
29692975

29702976
// add config parameter related to resolution

0 commit comments

Comments
 (0)