fix(feishu): tolerate null text fields when extracting post content

This commit is contained in:
santhreal
2026-07-26 22:51:49 +08:00
committed by Xubin Ren
parent d576804f23
commit fb88154377
2 changed files with 32 additions and 3 deletions
@@ -37,3 +37,24 @@ def test_extract_interactive_card_reads_table_rows() -> None:
}
assert _extract_share_card_content(content, "interactive") == "Name | Score\nAlice | 98"
from nanobot.channels.feishu.runtime import _extract_post_content
def test_extract_post_content_tolerates_null_text_fields() -> None:
text, images = _extract_post_content(
{
"title": "T",
"content": [
[
{"tag": "text", "text": None},
{"tag": "a", "text": None},
{"tag": "text", "text": "ok"},
{"tag": "code_block", "language": None, "text": None},
]
],
}
)
assert "ok" in text
assert images == []