@@ -149,3 +149,55 @@ def test_import_conversation_with_attachments(tmp_path):
149149 assert "**Attachment: test.txt**" in content
150150 assert "```" in content
151151 assert "Test file content" in content
152+
153+
154+ def test_import_conversation_with_none_text_values (tmp_path ):
155+ """Test importing conversation with None text values in content array (issue #236)."""
156+ # Create conversation with None text values
157+ conversation = {
158+ "uuid" : "test-uuid" ,
159+ "name" : "Test With None Text" ,
160+ "created_at" : "2025-01-05T20:55:32.499880+00:00" ,
161+ "updated_at" : "2025-01-05T20:56:39.477600+00:00" ,
162+ "chat_messages" : [
163+ {
164+ "uuid" : "msg-1" ,
165+ "text" : None ,
166+ "sender" : "human" ,
167+ "created_at" : "2025-01-05T20:55:32.499880+00:00" ,
168+ "content" : [
169+ {"type" : "text" , "text" : "Valid text here" },
170+ {"type" : "text" , "text" : None }, # This caused the TypeError
171+ {"type" : "text" , "text" : "More valid text" },
172+ ],
173+ },
174+ {
175+ "uuid" : "msg-2" ,
176+ "text" : None ,
177+ "sender" : "assistant" ,
178+ "created_at" : "2025-01-05T20:55:40.123456+00:00" ,
179+ "content" : [
180+ {"type" : "text" , "text" : None }, # All None case
181+ {"type" : "text" , "text" : None },
182+ ],
183+ },
184+ ],
185+ }
186+
187+ json_file = tmp_path / "with_none_text.json"
188+ with open (json_file , "w" , encoding = "utf-8" ) as f :
189+ json .dump ([conversation ], f )
190+
191+ config = get_project_config ()
192+ config .home = tmp_path
193+
194+ # Run import - should not fail with TypeError
195+ result = runner .invoke (app , ["import" , "claude" , "conversations" , str (json_file )])
196+ assert result .exit_code == 0
197+
198+ # Check that valid text is preserved and None values are filtered out
199+ conv_path = tmp_path / "conversations/20250105-Test_With_None_Text.md"
200+ assert conv_path .exists ()
201+ content = conv_path .read_text (encoding = "utf-8" )
202+ assert "Valid text here" in content
203+ assert "More valid text" in content
0 commit comments