Skip to content

Commit 5230680

Browse files
committedSep 29, 2017
Fix OGC test getfeatureinfo:invalid-info_format
1 parent e06ec71 commit 5230680

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
 

‎src/server/services/wms/qgswmsparameters.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,8 +1179,12 @@ namespace QgsWms
11791179
f = Format::XML;
11801180
else if ( fStr.startsWith( QLatin1String( "text/html" ), Qt::CaseInsensitive ) )
11811181
f = Format::HTML;
1182+
else if ( fStr.startsWith( QLatin1String( "text/plain" ), Qt::CaseInsensitive ) )
1183+
f = Format::TEXT;
11821184
else if ( fStr.startsWith( QLatin1String( "application/vnd.ogc.gml" ), Qt::CaseInsensitive ) )
11831185
f = Format::GML;
1186+
else
1187+
f = Format::NONE;
11841188

11851189
return f;
11861190
}

‎src/server/services/wms/qgswmsrenderer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,13 @@ namespace QgsWms
998998
QByteArray ba;
999999

10001000
QgsWmsParameters::Format infoFormat = mWmsParameters.infoFormat();
1001-
if ( infoFormat == QgsWmsParameters::Format::TEXT )
1001+
1002+
if ( infoFormat == QgsWmsParameters::Format::NONE )
1003+
{
1004+
throw QgsBadRequestException( QStringLiteral( "InvalidFormat" ),
1005+
QStringLiteral( "Invalid INFO_FORMAT parameter" ) );
1006+
}
1007+
else if ( infoFormat == QgsWmsParameters::Format::TEXT )
10021008
ba = convertFeatureInfoToText( result );
10031009
else if ( infoFormat == QgsWmsParameters::Format::HTML )
10041010
ba = convertFeatureInfoToHtml( result );

0 commit comments

Comments
 (0)
Please sign in to comment.