1.5.2-Fix

This commit is contained in:
RachelOS
2026-04-28 22:53:46 +08:00
parent 7acb205dcc
commit b054c741fa
+5 -6
View File
@@ -157,13 +157,12 @@ class Db:
and existing_article.status!=DATA_STATUS.DELETED \
and art.title==existing_article.title: # type: ignore
return False
art.content=existing_article.content # type: ignore
art.content_html = sanitize_utf8(art.content_html) if art.content_html else None # type: ignore
if art.content_html is None:
if art.content is None:
from tools.fix import fix_html
art.content_html = fix_html(art.content) # type: ignore
# 设置 has_content 字段
art.has_content = 1 if (art.content and art.content.strip()) else 0 # type: ignore
# 设置 has_content 字段
art.has_content = 1 if (art.content and art.content.strip()) else 0 # type: ignore
session.merge(art) # 使用 merge 来更新现有记录
session.commit()
print_warning(f"Article already exists: {art.id}")
@@ -185,7 +184,7 @@ class Db:
art.content = sanitize_utf8(art.content) if art.content else None # type: ignore
art.content_html = sanitize_utf8(art.content_html) if art.content_html else None # type: ignore
if art.content_html is None:
if art.content is not None:
from tools.fix import fix_html
art.content_html = fix_html(art.content) # type: ignore