From 090b182714a792519c23d91e074b134e8a54b3ec Mon Sep 17 00:00:00 2001 From: Michel-Marie MAUDET Date: Thu, 26 Mar 2026 09:01:10 +0100 Subject: [PATCH] fix: handle None paragraph style in DOCX extraction `para.style` can be None for paragraphs in some DOCX files (e.g. documents converted from other formats). This caused ingestion to crash with "'NoneType' object has no attribute 'name'", skipping the entire document. Fixes #6 --- ingestion/extraction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingestion/extraction.py b/ingestion/extraction.py index 3e9e5fc..9e23905 100644 --- a/ingestion/extraction.py +++ b/ingestion/extraction.py @@ -145,7 +145,7 @@ def _extract_docx(content: bytes) -> ExtractedText: if not text: continue - style_name = (para.style.name or "").lower() + style_name = ((para.style.name if para.style else "") or "").lower() if "heading" in style_name: # Extract heading level from style name (e.g., "Heading 2") level_match = re.search(r"(\d+)", style_name)