From 7c7a60948c1557e6eaac0caa1cc3ee9d73bbf099 Mon Sep 17 00:00:00 2001 From: selnem Date: Sun, 14 Jun 2026 14:53:20 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B3=B5=EB=AA=A8=EC=A0=84=20=EC=8A=AC?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=93=9C=20=EB=B9=88=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=EB=A5=BC=20=EC=A0=95=EA=B7=9C=ED=99=94=20=EC=9D=B4=ED=9B=84?= =?UTF-8?q?=EC=97=90=20=EC=88=98=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prepare_contest_slides에서 is_contest_slide_empty가 원본 슬라이드에 먼저 호출되어 items에 문자열이 있으면 AttributeError가 발생할 수 있고, value/content 키 항목이 비어 있다고 잘못 판단될 수 있었다. normalize_contest_slide_copy 후 필터링하도록 순서를 바꾸고, is_contest_slide_empty의 items 판별에 문자열 방어 처리를 추가한다. --- app/contest_cardnews/copy.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/contest_cardnews/copy.py b/app/contest_cardnews/copy.py index 6aba3df..4e06c6a 100644 --- a/app/contest_cardnews/copy.py +++ b/app/contest_cardnews/copy.py @@ -137,10 +137,14 @@ def is_contest_slide_empty(slide: dict[str, Any]) -> bool: or bool(str(slide.get("headline") or "").strip()) ) if slide.get("items"): - return len([i for i in slide["items"] if str(i.get("text") or "").strip()]) == 0 + return len([ + i for i in slide["items"] + if (str(i.get("text") or "").strip() if isinstance(i, dict) else str(i).strip()) + ]) == 0 return not bool(str(slide.get("body") or slide.get("headline") or "").strip()) def prepare_contest_slides(slides: list[dict[str, Any]]) -> list[dict[str, Any]]: rows = compact_contest_deck(slides) - return [normalize_contest_slide_copy(s) for s in rows if not is_contest_slide_empty(s)] + normalized = [normalize_contest_slide_copy(s) for s in rows] + return [s for s in normalized if not is_contest_slide_empty(s)]