Skip to content

Commit ad7ab51

Browse files
committedJan 21, 2019
WFS EXP_FILTER respect complex expressions
1 parent d4ac931 commit ad7ab51

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed
 

‎src/server/services/wfs/qgswfsparameters.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,23 @@ namespace QgsWfs
7676
if ( val.isEmpty() )
7777
return theList;
7878

79-
QRegExp rx( exp );
80-
if ( rx.indexIn( val, 0 ) == -1 )
81-
{
79+
if ( exp.isEmpty() )
8280
theList << val;
83-
}
8481
else
8582
{
86-
int pos = 0;
87-
while ( ( pos = rx.indexIn( val, pos ) ) != -1 )
83+
QRegExp rx( exp );
84+
if ( rx.indexIn( val, 0 ) == -1 )
85+
{
86+
theList << val;
87+
}
88+
else
8889
{
89-
theList << rx.cap( 1 );
90-
pos += rx.matchedLength();
90+
int pos = 0;
91+
while ( ( pos = rx.indexIn( val, pos ) ) != -1 )
92+
{
93+
theList << rx.cap( 1 );
94+
pos += rx.matchedLength();
95+
}
9196
}
9297
}
9398

@@ -332,7 +337,7 @@ namespace QgsWfs
332337

333338
QStringList QgsWfsParameters::expFilters() const
334339
{
335-
return mWfsParameters[ QgsWfsParameter::EXP_FILTER ].toStringListWithExp();
340+
return mWfsParameters[ QgsWfsParameter::EXP_FILTER ].toStringListWithExp( QString( ) );
336341
}
337342

338343
QString QgsWfsParameters::geometryNameAsString() const

‎src/server/services/wfs/qgswfsparameters.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ namespace QgsWfs
8383

8484
/**
8585
* Converts the parameter into a list of string.
86-
* \param exp The expression to use for splitting
86+
* \param exp The expression to use for splitting, pass an empty string to avoid splitting
8787
* \returns A list of strings
8888
* \throws QgsBadRequestException Invalid parameter exception
8989
*/

0 commit comments

Comments
 (0)
Please sign in to comment.