Skip to content

Commit

Permalink
Merge pull request #41335 from elpaso/bugfix-gh41292-server-cascading…
Browse files Browse the repository at this point in the history
…-namespace-double-colon

Replace colon in typenames
  • Loading branch information
elpaso committed Feb 6, 2021
2 parents 20a066d + 65b272d commit 97a5237
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/server/services/wfs/qgswfsgetfeature.cpp
Expand Up @@ -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 ) );
}
Expand Down Expand Up @@ -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() );
}
Expand Down
7 changes: 4 additions & 3 deletions src/server/services/wfs/qgswfsutils.cpp
Expand Up @@ -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 );
Expand All @@ -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 )
Expand Down

0 comments on commit 97a5237

Please sign in to comment.