From a65d351a51784aa68eea34162bcaab4745e652b0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 30 Jan 2020 08:22:46 +0000 Subject: [PATCH] wfs server: don't report unsupported DWithin/Beyond in capabilities and properly report failure to decode filters containing them --- src/server/services/wfs/qgswfsgetcapabilities.cpp | 3 +-- src/server/services/wfs/qgswfsutils.cpp | 2 +- tests/testdata/qgis_server/wfs_getcapabilities.txt | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/server/services/wfs/qgswfsgetcapabilities.cpp b/src/server/services/wfs/qgswfsgetcapabilities.cpp index e5a516f0dde5..df490cd2bb1b 100644 --- a/src/server/services/wfs/qgswfsgetcapabilities.cpp +++ b/src/server/services/wfs/qgswfsgetcapabilities.cpp @@ -126,8 +126,7 @@ namespace QgsWfs QStringList spatialOperators; spatialOperators << QStringLiteral( "Equals" ) << QStringLiteral( "Disjoint" ) << QStringLiteral( "Touches" ) << QStringLiteral( "Within" ) << QStringLiteral( "Overlaps" ) << QStringLiteral( "Crosses" ) - << QStringLiteral( "Intersects" ) << QStringLiteral( "Contains" ) << QStringLiteral( "DWithin" ) - << QStringLiteral( "Beyond" ) << QStringLiteral( "BBOX" ); + << QStringLiteral( "Intersects" ) << QStringLiteral( "Contains" ) << QStringLiteral( "BBOX" ); QDomElement spatialOperatorsElem = doc.createElement( QStringLiteral( "ogc:SpatialOperators" ) ); for ( const QString &spatialOperator : spatialOperators ) { diff --git a/src/server/services/wfs/qgswfsutils.cpp b/src/server/services/wfs/qgswfsutils.cpp index 4dbb4ba6b549..2f6b67c85e30 100644 --- a/src/server/services/wfs/qgswfsutils.cpp +++ b/src/server/services/wfs/qgswfsutils.cpp @@ -281,7 +281,7 @@ namespace QgsWfs std::shared_ptr filter( QgsOgcUtils::expressionFromOgcFilter( filterElem, layer ) ); if ( filter ) { - if ( filter->hasParserError() ) + if ( filter->hasParserError() || !filter->parserErrorString().isEmpty() ) { throw QgsRequestNotWellFormedException( filter->parserErrorString() ); } diff --git a/tests/testdata/qgis_server/wfs_getcapabilities.txt b/tests/testdata/qgis_server/wfs_getcapabilities.txt index 8cdfce6b449e..748c6ed66666 100644 --- a/tests/testdata/qgis_server/wfs_getcapabilities.txt +++ b/tests/testdata/qgis_server/wfs_getcapabilities.txt @@ -122,8 +122,6 @@ Content-Type: text/xml; charset=utf-8 - -