Skip to content
Permalink
Browse files

Replace colon in typenames

Fixes #41292 QGISserver WFS returns invalid GML in case of cascading WFS

(cherry picked from commit 65b272d)
  • Loading branch information
elpaso authored and nyalldawson committed Mar 19, 2021
1 parent 03d8ed3 commit 8cb8164d71bb8da423216372db6a0c8a5cf63c41
Showing with 6 additions and 5 deletions.
  1. +2 −2 src/server/services/wfs/qgswfsgetfeature.cpp
  2. +4 −3 src/server/services/wfs/qgswfsutils.cpp
@@ -201,7 +201,7 @@ namespace QgsWfs
getFeatureQuery &query = *qIt;
QString typeName = query.typeName;

if ( !mapLayerMap.keys().contains( typeName ) )
if ( !mapLayerMap.contains( typeName ) )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "TypeName '%1' unknown" ).arg( typeName ) );
}
@@ -333,7 +333,7 @@ namespace QgsWfs
accessControl->filterFeatures( vlayer, featureRequest );

QStringList attributes = QStringList();
for ( int idx : attrIndexes )
for ( int idx : qgis::as_const( attrIndexes ) )
{
attributes.append( vlayer->fields().field( idx ).name() );
}
@@ -56,7 +56,8 @@ namespace QgsWfs
href = request.originalUrl();
QUrlQuery q( href );

for ( auto param : q.queryItems() )
const auto constQueryItems = q.queryItems();
for ( const auto &param : constQueryItems )
{
if ( sFilter.contains( param.first.toUpper() ) )
q.removeAllQueryItems( param.first );
@@ -73,14 +74,14 @@ namespace QgsWfs
QString name = layer->name();
if ( !layer->shortName().isEmpty() )
name = layer->shortName();
name = name.replace( ' ', '_' );
name = name.replace( ' ', '_' ).replace( ':', '-' );
return name;
}

QgsVectorLayer *layerByTypeName( const QgsProject *project, const QString &typeName )
{
QStringList layerIds = QgsServerProjectUtils::wfsLayerIds( *project );
for ( const QString &layerId : layerIds )
for ( const QString &layerId : qgis::as_const( layerIds ) )
{
QgsMapLayer *layer = project->mapLayer( layerId );
if ( !layer )

0 comments on commit 8cb8164

Please sign in to comment.