From f7e72513c7a7cdd209eaad5a29d03939aee2f00b Mon Sep 17 00:00:00 2001 From: sijandh35 Date: Fri, 3 Apr 2026 13:34:37 +0000 Subject: [PATCH 1/3] [Fixes #14095] Upload thumbnails through the UI for the remote spatial datasets --- geonode/resource/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geonode/resource/manager.py b/geonode/resource/manager.py index 528f3d6628b..6b44af63f00 100644 --- a/geonode/resource/manager.py +++ b/geonode/resource/manager.py @@ -956,7 +956,7 @@ def set_thumbnail( map_thumb_from_bbox: bool = False, ) -> bool: _resource = instance or ResourceManager._get_instance(uuid) - if _resource and _resource.can_have_thumbnail: + if _resource and (_resource.can_have_thumbnail or thumbnail is not None): try: with transaction.atomic(): if thumbnail: From 5ce7c8743f60b0ff23e197c3500bef4654c819fe Mon Sep 17 00:00:00 2001 From: sijandh35 Date: Fri, 3 Apr 2026 13:45:52 +0000 Subject: [PATCH 2/3] [Fixes #14095] update review suggestion --- geonode/resource/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geonode/resource/manager.py b/geonode/resource/manager.py index 6b44af63f00..5e84fc927f4 100644 --- a/geonode/resource/manager.py +++ b/geonode/resource/manager.py @@ -956,7 +956,7 @@ def set_thumbnail( map_thumb_from_bbox: bool = False, ) -> bool: _resource = instance or ResourceManager._get_instance(uuid) - if _resource and (_resource.can_have_thumbnail or thumbnail is not None): + if _resource and (thumbnail or _resource.can_have_thumbnail): try: with transaction.atomic(): if thumbnail: From 70fa0cab92638a74bcaa724b14fe35975fff7e14 Mon Sep 17 00:00:00 2001 From: sijandh35 Date: Mon, 13 Apr 2026 07:07:12 +0000 Subject: [PATCH 3/3] [Fixes #14095] make can_have_thumbnail property to can_set_thumbnail method --- geonode/base/models.py | 12 ++++++++++-- geonode/resource/manager.py | 2 +- geonode/upload/handlers/common/remote.py | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/geonode/base/models.py b/geonode/base/models.py index d5469477d78..c54112e6e33 100644 --- a/geonode/base/models.py +++ b/geonode/base/models.py @@ -969,8 +969,16 @@ def can_have_wps_links(self): def can_have_style(self): return self.subtype not in {"tileStore", "remote"} - @property - def can_have_thumbnail(self): + def can_set_thumbnail(self, thumbnail_data=None): + """ + Decide whether the resource allows setting a thumbnail. + Manual uploads are allowed; otherwise, only subtypes that + support auto-generated thumbnails are permitted. + """ + if thumbnail_data: + return True + + # No thumbnail data provided: allow only subtypes that support auto-generation. return self.subtype not in {"3dtiles", "cog", "flatgeobuf"} @property diff --git a/geonode/resource/manager.py b/geonode/resource/manager.py index c307a4158e4..5c0b3fdd8f6 100644 --- a/geonode/resource/manager.py +++ b/geonode/resource/manager.py @@ -959,7 +959,7 @@ def set_thumbnail( map_thumb_from_bbox: bool = False, ) -> bool: _resource = instance or BaseResourceManager._get_instance(uuid) - if _resource and (thumbnail or _resource.can_have_thumbnail): + if _resource and _resource.can_set_thumbnail(thumbnail): try: with transaction.atomic(): if thumbnail: diff --git a/geonode/upload/handlers/common/remote.py b/geonode/upload/handlers/common/remote.py index 34d5cfeccc1..04d9487b8a9 100755 --- a/geonode/upload/handlers/common/remote.py +++ b/geonode/upload/handlers/common/remote.py @@ -220,7 +220,7 @@ def create_geonode_resource( defaults=self.generate_resource_payload(layer_name, alternate, asset, _exec, None, **params), ) # The thumbnail is not created for the following data types: "3dtiles", "cog", "flatgeobuf" - # because of the can_have_thumbnail property + # because of the can_set_thumbnail method resource_manager_registry.get_for_instance(resource).set_thumbnail(None, instance=resource) resource = self.create_link(resource, params, alternate)