c2cgeoportal icon indicating copy to clipboard operation
c2cgeoportal copied to clipboard

"TypeError: 'NoneType' object is not iterable" if WFS server returns an HTML document instead of XML capabilities

Open danduk82 opened this issue 3 years ago • 2 comments

Bug description:

if the WFS URL is set to a server that respond with an html document, the attributes are set to None, and the themes.py raises the following error TypeError: 'NoneType' object is not iterable at returns a Http 500 status at this line.

In my opinion it is strange that attributes is still of NoneType at this stage (it is intialized as None here, as it should have been re-initialized to an empty dict here and overwritten. But it appears not to be the case.

Expected behaviour:

At least the exception should be correctly handled and not return a 500.

Ideally the wfs parser should return an empty dict with an error that tells that it didn't receive a valid WFS capability response.

How to reproduce:

We found this bug because of a misconfiguration in admin interface by the client. To reproduce the bug create an OGC server with the following configuration:

BASIS_URL = https://geodienste.ch/db/av_0/deu
WFS_URL = https://geodienste.ch/
[x] WFS support

GMF versions

(we found the bug on 2.5, I presume the problem is still present in 2.6 and master, but I didn't test)

  • 2.5
  • 2.6
  • master

danduk82 avatar Mar 25 '21 09:03 danduk82

see also:

  • https://github.com/camptocamp/c2cgeoportal/blob/2.6/geoportal/c2cgeoportal_geoportal/views/theme.py#L1009
  • https://github.com/camptocamp/c2cgeoportal/blob/master/geoportal/c2cgeoportal_geoportal/views/theme.py#L1036

danduk82 avatar Mar 25 '21 09:03 danduk82

I ran into the same error with the following parameters (also on 2.5):

BASIS_URL = https://wms.geo.admin.ch/?VERSION=1.3.0
WFS_URL = 
[x] WFS support

The WMS version is used for the WFS request and it is not supported by the server, although it responds with an XML (https://wms.geo.admin.ch/?VERSION=1.3.0&SERVICE=WFS&REQUEST=DescribeFeatureType&ROLE_ID=0&USER_ID=0)

vuilleumierc avatar Mar 25 '21 14:03 vuilleumierc