fix: add fallback to placeholder icon when no icon is found in slide processing

This commit is contained in:
sudipnext 2026-01-04 17:49:22 +05:45
parent c5e36ab565
commit d623fa6670

View file

@ -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)