#36246: BaseGeometryWidget.deserialize() does not catch GDALException from
malformed GeoJSON
------------------------------+------------------------------------
     Reporter:  David Buhler  |                    Owner:  (none)
         Type:  Bug           |                   Status:  new
    Component:  GIS           |                  Version:  4.2
     Severity:  Normal        |               Resolution:
     Keywords:                |             Triage Stage:  Accepted
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+------------------------------------
Changes (by Sarah Boyce):

 * cc: Claude Paroz (added)
 * stage:  Unreviewed => Accepted
 * summary:  Malformed GeoJSON throws server error =>
     BaseGeometryWidget.deserialize() does not catch GDALException from
     malformed GeoJSON

Comment:

 Thank you for the report

 Replicated, possible test
 {{{#!diff
 diff --git a/tests/gis_tests/test_geoforms.py
 b/tests/gis_tests/test_geoforms.py
 index c351edaaad..b6068948f3 100644
 --- a/tests/gis_tests/test_geoforms.py
 +++ b/tests/gis_tests/test_geoforms.py
 @@ -435,6 +435,19 @@ class GeometryWidgetTests(SimpleTestCase):
          context = widget.get_context("geometry", None, None)
          self.assertEqual(context["geom_type"], "Geometry")

 +    def test_invalid_values(self):
 +        bad_inputs = [
 +            "POINT(5)",
 +            "MULTI   POLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))",
 +            "BLAH(0 0, 1 1)",
 +            '{"type": "FeatureCollection", "features": ['
 +            '{"geometry": {"type": "Point", "coordinates": [508375,
 148905]}, '
 +            '"type": "Feature"}]}',
 +        ]
 +        for input in bad_inputs:
 +            with self.subTest(input=input):
 +
 self.assertIsNone(BaseGeometryWidget().deserialize(input))
 +
      def test_subwidgets(self):
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36246#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019589548f96-b1f9dfa4-a53a-40f9-8e4b-6ed2270e976e-000000%40eu-central-1.amazonses.com.

Reply via email to