Skip to content

Commit 543d521

Browse files
rduivenvoordeNathanW2
authored andcommittedJun 21, 2016
WMS GetLegendGraphic fix #15055 (#3213)
When creating the legend image url, this tests for available queryparams in a case-insensitive way...
1 parent 3e1971b commit 543d521

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
@@ -2990,19 +2990,25 @@ QUrl QgsWmsProvider::getLegendGraphicFullURL( double scale, const QgsRectangle&
29902990

29912991
QUrl url( lurl );
29922992

2993-
if ( !url.hasQueryItem( "SERVICE" ) )
2993+
// query names are NOT case-sensitive, so make an uppercase list for proper comparison
2994+
QStringList qnames = QStringList();
2995+
for ( int i = 0; i < url.queryItems().size(); i++ )
2996+
{
2997+
qnames << url.queryItems().at( i ).first.toUpper();
2998+
}
2999+
if ( !qnames.contains( "SERVICE" ) )
29943000
setQueryItem( url, "SERVICE", "WMS" );
2995-
if ( !url.hasQueryItem( "VERSION" ) )
3001+
if ( !qnames.contains( "VERSION" ) )
29963002
setQueryItem( url, "VERSION", mCaps.mCapabilities.version );
2997-
if ( !url.hasQueryItem( "SLD_VERSION" ) )
3003+
if ( !qnames.contains( "SLD_VERSION" ) )
29983004
setQueryItem( url, "SLD_VERSION", "1.1.0" ); // can not determine SLD_VERSION
2999-
if ( !url.hasQueryItem( "REQUEST" ) )
3005+
if ( !qnames.contains( "REQUEST" ) )
30003006
setQueryItem( url, "REQUEST", "GetLegendGraphic" );
3001-
if ( !url.hasQueryItem( "FORMAT" ) )
3007+
if ( !qnames.contains( "FORMAT" ) )
30023008
setFormatQueryItem( url );
3003-
if ( !url.hasQueryItem( "LAYER" ) )
3009+
if ( !qnames.contains( "LAYER" ) )
30043010
setQueryItem( url, "LAYER", mSettings.mActiveSubLayers[0] );
3005-
if ( !url.hasQueryItem( "STYLE" ) )
3011+
if ( !qnames.contains( "STYLE" ) )
30063012
setQueryItem( url, "STYLE", mSettings.mActiveSubStyles[0] );
30073013

30083014
// add config parameter related to resolution

0 commit comments

Comments
 (0)
Please sign in to comment.