From 8d8fe8775724738d9d9917220cd78a8f9a343823 Mon Sep 17 00:00:00 2001
From: Jesper Zedlitz <jesper@zedlitz.de>
Date: Mon, 6 Jan 2025 08:49:04 +0100
Subject: [PATCH] check that the file could be read

---
 formats/geotiff_format.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/formats/geotiff_format.py b/formats/geotiff_format.py
index 338172b..d291e1a 100644
--- a/formats/geotiff_format.py
+++ b/formats/geotiff_format.py
@@ -7,6 +7,10 @@ import os
 def is_geotiff(resource, file_name):
     dataset = gdal.Open(file_name)
 
+    if not dataset:
+        resource["error"] = f"could not read file {file_name}"
+        return False
+
     geotransform = dataset.GetGeoTransform()
     default_transform = (0.0, 1.0, 0.0, 0.0, 0.0, 1.0)
 
-- 
GitLab