Opened 14 hours ago
Last modified 77 minutes ago
#36246 assigned Bug
BaseGeometryWidget.deserialize() does not catch GDALException from malformed GeoJSON
Reported by: | David Buhler | Owned by: | JaeHyuckSa |
---|---|---|---|
Component: | GIS | Version: | 4.2 |
Severity: | Normal | Keywords: | |
Cc: | Claude Paroz | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When passing malformed GeoJSON, either using incorrect GeoJSON values or simply malformed JSON, a GDALException is raised:
This differs from the GEOSException that is thrown when passing in WKT:
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.
Change History (4)
comment:1 by , 4 hours ago
Cc: | added |
---|---|
Summary: | Malformed GeoJSON throws server error → BaseGeometryWidget.deserialize() does not catch GDALException from malformed GeoJSON |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 86 minutes ago
Has patch: | set |
---|---|
Owner: | set to |
Status: | new → assigned |
comment:3 by , 82 minutes ago
Has patch: | unset |
---|
comment:4 by , 77 minutes ago
Has patch: | set |
---|
Thank you for the report
Replicated, possible test
tests/gis_tests/test_geoforms.py