From 9f8643c1f8add8819f396eeb616f19b181d61dd6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EB=B0=95=EC=84=9C=EC=9D=80?=
<61147083+BangSun98@users.noreply.github.com>
Date: Thu, 19 Jun 2025 18:32:39 +0900
Subject: [PATCH] Update sns_content_service.py
---
smarketing-ai/services/sns_content_service.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/smarketing-ai/services/sns_content_service.py b/smarketing-ai/services/sns_content_service.py
index 3e37bb6..0e6d3df 100644
--- a/smarketing-ai/services/sns_content_service.py
+++ b/smarketing-ai/services/sns_content_service.py
@@ -1946,7 +1946,13 @@ class SnsContentService:
# 2. 네이버 블로그인 경우 이미지 태그를 실제 이미지로 변환
elif request.platform == '네이버 블로그' and image_placement_plan:
- content = self._replace_image_tags_with_html(content, image_placement_plan, request.images)
+ if image_placement_plan and request.images:
+ content = self._replace_image_tags_with_html(content, image_placement_plan, request.images)
+ else:
+ # 🔥 추가: 이미지가 없는 경우 [IMAGE_X] 태그 제거
+ import re
+ content = re.sub(r'\[IMAGE_\d+\]', '', content)
+ content = re.sub(r'\n\s*\n\s*\n', '\n\n', content) # 빈 줄 정리
# 3. 실제 줄바꿈을
태그로 변환
content = content.replace('\n', '
')