Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #35946 from elpaso/server-wfs3-little-cleanup
Browse files Browse the repository at this point in the history
Server little cleanup (class documentation)
  • Loading branch information
elpaso committed Apr 23, 2020
2 parents 69d88d1 + 860fb23 commit 6bab957
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
7 changes: 5 additions & 2 deletions python/server/auto_generated/qgsserverapiutils.sip.in
Expand Up @@ -114,8 +114,11 @@ This method takes into account the ACL restrictions provided by QGIS Server Acce

static QString sanitizedFieldValue( const QString &value );
%Docstring
Sanitizes the input ``value`` by removing URL encoding and checking for malicious content.
In case of failure returns an empty string.
Sanitizes the input ``value`` by removing URL encoding.

.. note::

the returned value is meant to become part of a QgsExpression filter
%End

static QStringList publishedCrsList( const QgsProject *project );
Expand Down
5 changes: 0 additions & 5 deletions src/server/qgsserverapiutils.cpp
Expand Up @@ -569,11 +569,6 @@ const QVector<QgsVectorLayer *> QgsServerApiUtils::publishedWfsLayers( const Qgs
QString QgsServerApiUtils::sanitizedFieldValue( const QString &value )
{
QString result { QUrl( value ).toString() };
static const QRegularExpression re( R"raw(;.*(DROP|DELETE|INSERT|UPDATE|CREATE|INTO))raw" );
if ( re.match( result.toUpper() ).hasMatch() )
{
result = QString();
}
return result.replace( '\'', QStringLiteral( "\'" ) );
}

Expand Down
4 changes: 2 additions & 2 deletions src/server/qgsserverapiutils.h
Expand Up @@ -203,8 +203,8 @@ class SERVER_EXPORT QgsServerApiUtils


/**
* Sanitizes the input \a value by removing URL encoding and checking for malicious content.
* In case of failure returns an empty string.
* Sanitizes the input \a value by removing URL encoding.
* \note the returned value is meant to become part of a QgsExpression filter
*/
static QString sanitizedFieldValue( const QString &value );

Expand Down
8 changes: 6 additions & 2 deletions src/server/services/wfs3/qgswfs3handlers.h
Expand Up @@ -111,7 +111,9 @@ class QgsWfs3StaticHandler: public QgsServerOgcApiHandler

};


/**
* The QgsWfs3LandingPageHandler is the landing page handler.
*/
class QgsWfs3LandingPageHandler: public QgsServerOgcApiHandler
{
public:
Expand All @@ -138,7 +140,9 @@ class QgsWfs3LandingPageHandler: public QgsServerOgcApiHandler
json schema( const QgsServerApiContext &context ) const override;
};


/**
* The QgsWfs3ConformanceHandler class shows the conformance links.
*/
class QgsWfs3ConformanceHandler: public QgsServerOgcApiHandler
{
public:
Expand Down
2 changes: 2 additions & 0 deletions tests/src/python/test_qgsserver_api.py
Expand Up @@ -81,6 +81,8 @@ def test_parse_crs(self):

crs = QgsServerApiUtils.parseCrs('http://www.opengis.net/def/crs/OGC/1.3/CRS84')
self.assertTrue(crs.isValid())

crs = QgsServerApiUtils.parseCrs('http://www.opengis.net/def/crs/EPSG/9.6.2/4326')
self.assertEquals(crs.postgisSrid(), 4326)

crs = QgsServerApiUtils.parseCrs('http://www.opengis.net/def/crs/EPSG/9.6.2/3857')
Expand Down

0 comments on commit 6bab957

Please sign in to comment.