Skip to content

Commit

Permalink
Raise an error if a typename is invalid in GetFeature
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Feb 4, 2022
1 parent d5d3ed6 commit 786c675
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/server/services/wfs/qgswfsgetfeature.cpp
Expand Up @@ -185,6 +185,15 @@ namespace QgsWfs
}
}

// check if all typename are valid
for ( const QString &typeName : typeNameList )
{
if ( !mapLayerMap.contains( typeName ) )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "TypeName '%1' unknown" ).arg( typeName ) );
}
}

#ifdef HAVE_SERVER_PYTHON_PLUGINS
QgsAccessControl *accessControl = serverIface->accessControls();
//scoped pointer to restore all original layer filters (subsetStrings) when pointer goes out of scope
Expand All @@ -205,11 +214,6 @@ namespace QgsWfs
getFeatureQuery &query = *qIt;
QString typeName = query.typeName;

if ( !mapLayerMap.contains( typeName ) )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "TypeName '%1' unknown" ).arg( typeName ) );
}

QgsMapLayer *layer = mapLayerMap[typeName];
#ifdef HAVE_SERVER_PYTHON_PLUGINS
if ( accessControl && !accessControl->layerReadPermission( layer ) )
Expand Down

0 comments on commit 786c675

Please sign in to comment.