From 14a3efd7565b3a638fa1cb6b2acda01632b8d826 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Mon, 7 Apr 2025 12:33:34 +0800 Subject: [PATCH] Fix: docx image exceptions. (#6839) ### What problem does this PR solve? Close #6784 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/app/naive.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rag/app/naive.py b/rag/app/naive.py index f771f665..a3c629e1 100644 --- a/rag/app/naive.py +++ b/rag/app/naive.py @@ -44,7 +44,10 @@ class Docx(DocxParser): if not img: return None img = img[0] - embed = img.xpath('.//a:blip/@r:embed')[0] + embed = img.xpath('.//a:blip/@r:embed') + if not embed: + return None + embed = embed[0] related_part = document.part.related_parts[embed] try: image_blob = related_part.image.blob