From 44020ee9ec40032536f349b4600e2e241a521eb2 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 6 May 2025 00:05:42 -0400 Subject: [PATCH] Avoid locking users out of a map with an invalid crop --- app/api/tiler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/api/tiler.py b/app/api/tiler.py index 886e9a89..568dc70d 100644 --- a/app/api/tiler.py +++ b/app/api/tiler.py @@ -211,6 +211,13 @@ class Metadata(TaskNestedView): info = json.loads(metadata.json()) except IndexError as e: # Caught when trying to get an invalid raster metadata + # or when the crop area is defined improperly. In order + # to avoid locking the user out of the map, we remove cropping + # if this ever happens. + if task.crop is not None: + task.crop = None + task.save() + raise exceptions.ValidationError("Cannot retrieve raster metadata: %s" % str(e)) # Override min/max if hrange: