[Django] #36246: Malformed GeoJSON throws server error

2 views
Skip to first unread message

Django

unread,
Mar 11, 2025, 5:51:01 PM3/11/25
to django-...@googlegroups.com
#36246: Malformed GeoJSON throws server error
------------------------------+--------------------------------------
Reporter: David Buhler | Type: Bug
Status: new | Component: GIS
Version: 4.2 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
When passing malformed GeoJSON, either using incorrect GeoJSON values or
simply malformed JSON, a GDALException is raised:

https://github.com/django/django/blob/stable/4.2.x/django/contrib/gis/gdal/prototypes/errcheck.py#L75

This differs from the GEOSException that is thrown when passing in WKT:

https://github.com/django/django/blob/stable/4.2.x/django/contrib/gis/geos/prototypes/errcheck.py#L32

The GEOSException is handled during form deserialization, but not the
GDALException, during widget deserialization:
https://github.com/django/django/blob/stable/4.2.x/django/contrib/gis/forms/widgets.py#L54

This seems to be handled properly during field deserialization:
https://github.com/django/django/blob/stable/4.2.x/django/contrib/gis/forms/fields.py#L46

This remains an issue with the 5.2.x. branch.
--
Ticket URL: <https://code.djangoproject.com/ticket/36246>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages