Opened 6 months ago
Last modified 6 months 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: | yes |
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 (7)
comment:1 by , 6 months 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 , 6 months ago
Has patch: | set |
---|---|
Owner: | set to |
Status: | new → assigned |
comment:3 by , 6 months ago
Has patch: | unset |
---|
comment:4 by , 6 months ago
Has patch: | set |
---|
comment:5 by , 6 months ago
Patch needs improvement: | set |
---|
follow-up: 7 comment:6 by , 6 months ago
Hey folks, thanks for picking this up. Is there any chance this will make it into a 5.2.x release?
comment:7 by , 6 months ago
Replying to David Buhler:
Hey folks, thanks for picking this up. Is there any chance this will make it into a 5.2.x release?
The bug fix freeze for 5.2 was February 19th (see https://code.djangoproject.com/wiki/Version5.2Roadmap), so at the earliest this should be in 6.0.
Thank you for the report
Replicated, possible test
tests/gis_tests/test_geoforms.py