Skip to content

Commit a2bc1ff

Browse files
committed
Add getmap with error on filter
1 parent 053ab49 commit a2bc1ff

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/src/python/test_qgsserver_wms_getmap.py

+22
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,28 @@ def test_wms_getmap_filter(self):
817817
r, h = self._result(self._execute_request(qs))
818818
self._img_diff_error(r, h, "WMS_GetMap_Filter5")
819819

820+
# Error in filter (missing quote after africa) with multiple layer filter
821+
qs = "?" + "&".join(["%s=%s" % i for i in list({
822+
"MAP": urllib.parse.quote(self.projectPath),
823+
"SERVICE": "WMS",
824+
"VERSION": "1.1.1",
825+
"REQUEST": "GetMap",
826+
"LAYERS": "Country,Country_Diagrams,Hello",
827+
"STYLES": "",
828+
"FORMAT": "image/png",
829+
"BBOX": "1017529,-4226661,11271098,17063190",
830+
"HEIGHT": "500",
831+
"WIDTH": "500",
832+
"CRS": "EPSG:3857",
833+
"FILTER": "Country,Country_Diagrams: \"name\" IN ( 'africa , 'eurasia' );Hello: \"color\" IN ( 'magenta' , 'cerese' )"
834+
}.items())])
835+
836+
expected = self.strip_version_xmlns(b'<ServiceExceptionReport >\n <ServiceException code="Filter string rejected">The filter string "name" IN ( \'africa , \'eurasia\' ) has been rejected because of security reasons. Note: Text strings have to be enclosed in single or double quotes. A space between each word / special character is mandatory. Allowed Keywords and special characters are AND,OR,IN,&lt;,>=,>,>=,!=,\',\',(,),DMETAPHONE,SOUNDEX. Not allowed are semicolons in the filter expression.</ServiceException>\n</ServiceExceptionReport>\n')
837+
r, h = self._result(self._execute_request(qs))
838+
839+
self.assertEqual(self.strip_version_xmlns(r), expected)
840+
841+
820842
def test_wms_getmap_filter_ogc(self):
821843
filter = "<Filter><PropertyIsEqualTo><PropertyName>name</PropertyName>" + \
822844
"<Literal>eurasia</Literal></PropertyIsEqualTo></Filter>"

0 commit comments

Comments
 (0)