Closed DavidQuartz closed 2 years ago
@tdipisa @giohappy I find that the issue stems from how the filter is being parsed here Such filter data seems to already contain come CDATA, and so wrapping it in CDATA breaks the xml syntax. A proposed solution would be limit the cdata function to only wrap data which does not already include cdata.
@DavidQuartz could you please make a comment with the old broken xml payload and the new one?
@allyoucanmap Here is an example of an old broken xml payload
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.opengis.net/wps/1.0.0"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:wps="http://www.opengis.net/wps/1.0.0"
xmlns:ows="http://www.opengis.net/ows/1.1"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:wcs="http://www.opengis.net/wcs/1.1.1"
xmlns:dwn="http://geoserver.org/wps/download"
xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>gs:DownloadEstimator</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>layerName</ows:Identifier>
<wps:Data>
<wps:LiteralData>geonode:ProvCM01012019_g_WGS84_lKHiGZ3</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>filter</ows:Identifier>
<wps:Data>
<wps:ComplexData mimeType="text/xml; subtype=filter/1.1">
<![CDATA[<ogc:Filter
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"><ogc:And><ogc:Intersects><ogc:PropertyName>the_geom</ogc:PropertyName><ogc:Function name="collectGeometries"><ogc:Function name="queryCollection"><ogc:Literal>geonode:test_export_filter0</ogc:Literal><ogc:Literal>the_geom</ogc:Literal><ogc:Literal>
<![CDATA[INCLUDE]]>
</ogc:Literal>
</ogc:Function>
</ogc:Function>
</ogc:Intersects>
</ogc:And></ogc:Filter>]]>undefined</wps:ComplexData>undefined</wps:Data>undefined</wps:Input>undefined</wps:DataInputs>undefined</wps:Execute>
And here is the fixed version of it
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.opengis.net/wps/1.0.0"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:wps="http://www.opengis.net/wps/1.0.0"
xmlns:ows="http://www.opengis.net/ows/1.1"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:wcs="http://www.opengis.net/wcs/1.1.1"
xmlns:dwn="http://geoserver.org/wps/download"
xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>gs:DownloadEstimator</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>layerName</ows:Identifier>
<wps:Data>
<wps:LiteralData>geonode:ProvCM01012019_g_WGS84_lKHiGZ3</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>filter</ows:Identifier>
<wps:Data>
<wps:ComplexData mimeType="text/xml; subtype=filter/1.1">
<ogc:Filter
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml">
<ogc:And>
<ogc:Intersects>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<ogc:Function name="collectGeometries">
<ogc:Function name="queryCollection">
<ogc:Literal>geonode:test_export_filter0</ogc:Literal>
<ogc:Literal>the_geom</ogc:Literal>
<ogc:Literal>
<![CDATA[INCLUDE]]>
</ogc:Literal>
</ogc:Function>
</ogc:Function>
</ogc:Intersects>
</ogc:And>
</ogc:Filter>
</wps:ComplexData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
</wps:Execute>
Description
Downloading filtered layer data for a layer which was filtered based on another layer does not work.
How to reproduce
Expected Result
The layer data is downloaded
Current Result
An error is thrown
Browser info
(use this site: https://www.whatsmybrowser.org/ for non expert users) | Browser Affected | Version | |---|---| |Internet Explorer| | |Edge| | |Chrome| | |Firefox| | |Safari| |Other useful information
You may test with this map. It already contains a filtered dataset (Colorado Populated Places). From the network tab, this error is thrown