fix: Handle None text values in Claude conversations importer

- Add robust handling for None text values in content array
- Filter out None values before joining text content
- Ensure all text values are converted to strings
- Add comprehensive test case for None text values scenario

Fixes #236

Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com>
This commit is contained in:
claude[bot]
2025-09-26 14:52:03 +00:00
parent f40ab31685
commit b57cb3a785
2 changed files with 59 additions and 1 deletions
@@ -153,7 +153,14 @@ class ClaudeConversationsImporter(Importer[ChatImportResult]):
# Handle message content
content = msg.get("text", "")
if msg.get("content"):
content = " ".join(c.get("text", "") for c in msg["content"])
# Filter out None values and ensure all items are strings
valid_content = []
for c in msg["content"]:
if c and isinstance(c, dict):
text = c.get("text")
if text is not None:
valid_content.append(str(text))
content = " ".join(valid_content) if valid_content else ""
lines.append(content)
# Handle attachments