Skip to content

Conversation

@sofiapag
Copy link

@sofiapag sofiapag commented Jun 16, 2022

The following incorrectly formatted geojson source will result in an internal server error:

{"type": "MultiPoint", "geometry": [[134.519974,34.084171],[134.546188,34.081322],[134.546219,34.078766],[134.542374,34.081287]]}
{"type": "MultiPoint", "geometry": [[130.405380,33.571598],[130.383682,33.567059],[130.486740,33.652233],[130.455490,33.597004],[130.437195,33.601784],[130.447998,33.654606],[130.409592,33.606941]]}

This PR adds an else case to catch invalid types and raise a TypeError

Note: looks like the python 3.7 build is failing, but it was in previous commits as well. I wonder why...

@coveralls
Copy link

coveralls commented Jun 16, 2022

Coverage Status

Coverage increased (+0.006%) to 99.225% when pulling dfd5fa3 on add-type-check into 97f05d1 on master.

if newfeat:
yield newfeat
else:
raise TypeError("Type must be Feature or FeatureCollection")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment: the text in this error doesn't seem strictly true - it looks like {"coordinates": ...} will be accepted by line 120, which isn't a "Feature" or a "FeatureCollection".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to something more generic, "Invalid type" dfd5fa3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants