From d623fa66700df9c7394875fdba9e3e5c1f95f907 Mon Sep 17 00:00:00 2001 From: sudipnext Date: Sun, 4 Jan 2026 17:49:22 +0545 Subject: [PATCH] fix: add fallback to placeholder icon when no icon is found in slide processing --- servers/fastapi/utils/process_slides.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/servers/fastapi/utils/process_slides.py b/servers/fastapi/utils/process_slides.py index 87aa3e21..b9ddb1de 100644 --- a/servers/fastapi/utils/process_slides.py +++ b/servers/fastapi/utils/process_slides.py @@ -51,7 +51,12 @@ async def process_slide_and_fetch_assets( for icon_path in icon_paths: icon_dict = get_dict_at_path(slide.content, icon_path) - icon_dict["__icon_url__"] = results.pop()[0] + icon_result = results.pop() + if icon_result and len(icon_result) > 0: + icon_dict["__icon_url__"] = icon_result[0] + else: + # Fallback to placeholder if no icon found + icon_dict["__icon_url__"] = "/static/icons/placeholder.svg" set_dict_at_path(slide.content, icon_path, icon_dict) return return_assets @@ -159,7 +164,12 @@ async def process_old_and_new_slides_and_fetch_assets( for i, new_icon in enumerate(new_icons): if new_icons_fetch_status[i]: - new_icon_dicts[i]["__icon_url__"] = new_icons[i][0] + icon_result = new_icons[i] + if icon_result and len(icon_result) > 0: + new_icon_dicts[i]["__icon_url__"] = icon_result[0] + else: + # Fallback to placeholder if no icon found + new_icon_dicts[i]["__icon_url__"] = "/static/icons/placeholder.svg" for i, new_image_dict in enumerate(new_image_dicts): set_dict_at_path(new_slide_content, new_image_dict_paths[i], new_image_dict)