From c4570200ff7add65a9d06cebd94247c93c3af4ff Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 7 Dec 2023 22:08:19 +0100 Subject: [PATCH] Refactor code to handle missing "representations" key in instance data The code change modifies the `ExtractThumbnail` class in `extract_thumbnail.py`. It updates the loop that iterates over representations to handle cases where the "representations" key is missing from the instance data. This change ensures that cleanup occurs for representations with both "delete" and "need_thumbnail" tags. --- openpype/plugins/publish/extract_thumbnail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/plugins/publish/extract_thumbnail.py b/openpype/plugins/publish/extract_thumbnail.py index 2b4a61845d..2b4ea0529a 100644 --- a/openpype/plugins/publish/extract_thumbnail.py +++ b/openpype/plugins/publish/extract_thumbnail.py @@ -56,7 +56,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): # Make sure cleanup happens to representations which are having both # tags `delete` and `need_thumbnail` - for repre in tuple(instance.data["representations"]): + for repre in tuple(instance.data.get("representations", [])): tags = repre.get("tags") or [] # skip representations which are going to be published on farm if "publish_on_farm" in tags: