From 8793b39988b88aa94e7e7821903a20c00dd0a7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Cobi=C3=A1n?= Date: Wed, 12 Feb 2025 10:42:39 +0100 Subject: [PATCH] Check extension of the item href --- .../org/integratedmodelling/klab/stac/STACAssetParser.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/adapters/klab.ogc/src/main/java/org/integratedmodelling/klab/stac/STACAssetParser.java b/adapters/klab.ogc/src/main/java/org/integratedmodelling/klab/stac/STACAssetParser.java index f28739c1d..5ad10b3fb 100644 --- a/adapters/klab.ogc/src/main/java/org/integratedmodelling/klab/stac/STACAssetParser.java +++ b/adapters/klab.ogc/src/main/java/org/integratedmodelling/klab/stac/STACAssetParser.java @@ -13,6 +13,8 @@ public class STACAssetParser { "image/tiff;application=geotiff;profile=cloud-optimized", "image/vnd.stac.geotiff;profile=cloud-optimized", "image/vnd.stac.geotiff;cloud-optimized=true", "application/geo+json"); + final private static Set SUPPORTED_MEDIA_EXTENSION = Set.of(".tif", ".tiff"); + /** * Check if the MIME value is supported. * @param asset as JSON @@ -20,7 +22,8 @@ public class STACAssetParser { */ public static boolean isSupportedMediaType(JSONObject asset) { if (!asset.has("type")) { - return false; + String href = asset.getString("href"); + return SUPPORTED_MEDIA_EXTENSION.stream().anyMatch(ex -> href.toLowerCase().endsWith(ex)); } return SUPPORTED_MEDIA_TYPE.contains(asset.getString("type").replace(" ", "").toLowerCase()); }