Skip to content

Commit

Permalink
Fix OGC test getfeatureinfo:invalid-info_format
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Sep 29, 2017
1 parent e06ec71 commit 5230680
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/server/services/wms/qgswmsparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,8 +1179,12 @@ namespace QgsWms
f = Format::XML;
else if ( fStr.startsWith( QLatin1String( "text/html" ), Qt::CaseInsensitive ) )
f = Format::HTML;
else if ( fStr.startsWith( QLatin1String( "text/plain" ), Qt::CaseInsensitive ) )
f = Format::TEXT;
else if ( fStr.startsWith( QLatin1String( "application/vnd.ogc.gml" ), Qt::CaseInsensitive ) )
f = Format::GML;
else
f = Format::NONE;

return f;
}
Expand Down
8 changes: 7 additions & 1 deletion src/server/services/wms/qgswmsrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,13 @@ namespace QgsWms
QByteArray ba;

QgsWmsParameters::Format infoFormat = mWmsParameters.infoFormat();
if ( infoFormat == QgsWmsParameters::Format::TEXT )

if ( infoFormat == QgsWmsParameters::Format::NONE )
{
throw QgsBadRequestException( QStringLiteral( "InvalidFormat" ),
QStringLiteral( "Invalid INFO_FORMAT parameter" ) );
}
else if ( infoFormat == QgsWmsParameters::Format::TEXT )
ba = convertFeatureInfoToText( result );
else if ( infoFormat == QgsWmsParameters::Format::HTML )
ba = convertFeatureInfoToHtml( result );
Expand Down

0 comments on commit 5230680

Please sign in to comment.