mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Merge pull request #7751 from pblottiere/server_filter_segfault
[server] Fixes segfault when WMS OGC filter is empty
This commit is contained in:
commit
3ad3fc4f9c
@ -2811,7 +2811,11 @@ namespace QgsWms
|
||||
}
|
||||
QDomElement filterElem = filterXml.firstChildElement();
|
||||
std::unique_ptr<QgsExpression> expression( QgsOgcUtils::expressionFromOgcFilter( filterElem, filteredLayer ) );
|
||||
mFeatureFilter.setFilter( filteredLayer, *expression );
|
||||
|
||||
if ( expression )
|
||||
{
|
||||
mFeatureFilter.setFilter( filteredLayer, *expression );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -821,6 +821,51 @@ class TestQgsServerWMSGetMap(QgsServerTestBase):
|
||||
r, h = self._result(self._execute_request(qs))
|
||||
self._img_diff_error(r, h, "WMS_GetMap_Filter_OGC")
|
||||
|
||||
# empty filter
|
||||
filter = ("(<ogc:Filter xmlns=\"http://www.opengis.net/ogc\">"
|
||||
"</ogc:Filter>)")
|
||||
qs = "?" + "&".join(["%s=%s" % i for i in list({
|
||||
"MAP": urllib.parse.quote(self.projectPath),
|
||||
"SERVICE": "WMS",
|
||||
"VERSION": "1.1.1",
|
||||
"REQUEST": "GetMap",
|
||||
"LAYERS": "Country,Hello",
|
||||
"STYLES": "",
|
||||
"FORMAT": "image/png",
|
||||
"BBOX": "-16817707,-4710778,5696513,14587125",
|
||||
"HEIGHT": "500",
|
||||
"WIDTH": "500",
|
||||
"CRS": "EPSG:3857",
|
||||
"FILTER": filter
|
||||
}.items())])
|
||||
|
||||
r, h = self._result(self._execute_request(qs))
|
||||
self._img_diff_error(r, h, "WMS_GetMap_Filter_OGC2")
|
||||
|
||||
# filter on the second layer
|
||||
filter_hello = ("(<Filter></Filter>)")
|
||||
filter_country = ("(<Filter><PropertyIsEqualTo><PropertyName>name"
|
||||
"</PropertyName><Literal>eurasia</Literal>"
|
||||
"</PropertyIsEqualTo></Filter>)")
|
||||
filter = "{}{}".format(filter_hello, filter_country)
|
||||
qs = "?" + "&".join(["%s=%s" % i for i in list({
|
||||
"MAP": urllib.parse.quote(self.projectPath),
|
||||
"SERVICE": "WMS",
|
||||
"VERSION": "1.1.1",
|
||||
"REQUEST": "GetMap",
|
||||
"LAYERS": "Hello,Country",
|
||||
"STYLES": "",
|
||||
"FORMAT": "image/png",
|
||||
"BBOX": "-16817707,-4710778,5696513,14587125",
|
||||
"HEIGHT": "500",
|
||||
"WIDTH": "500",
|
||||
"CRS": "EPSG:3857",
|
||||
"FILTER": filter
|
||||
}.items())])
|
||||
|
||||
r, h = self._result(self._execute_request(qs))
|
||||
self._img_diff_error(r, h, "WMS_GetMap_Filter_OGC3")
|
||||
|
||||
def test_wms_getmap_selection(self):
|
||||
qs = "?" + "&".join(["%s=%s" % i for i in list({
|
||||
"MAP": urllib.parse.quote(self.projectPath),
|
||||
|
BIN
tests/testdata/control_images/qgis_server/WMS_GetMap_Filter_OGC2/WMS_GetMap_Filter_OGC2.png
vendored
Normal file
BIN
tests/testdata/control_images/qgis_server/WMS_GetMap_Filter_OGC2/WMS_GetMap_Filter_OGC2.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
BIN
tests/testdata/control_images/qgis_server/WMS_GetMap_Filter_OGC3/WMS_GetMap_Filter_OGC3.png
vendored
Normal file
BIN
tests/testdata/control_images/qgis_server/WMS_GetMap_Filter_OGC3/WMS_GetMap_Filter_OGC3.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Loading…
x
Reference in New Issue
Block a user