mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: docx parse error. (#8600)
### What problem does this PR solve? docx parse error.  ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) ### What problem does this PR solve? Some docx parse with naive cause error. `block.style.name` in Function `__get_nearest_title` will be None in some case. ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: wenxuan.zhang <wenxuan.zhang@chinacreator.com>
This commit is contained in:
@ -121,7 +121,7 @@ class Docx(DocxParser):
|
|||||||
if block_type != 'p':
|
if block_type != 'p':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if block.style and re.search(r"Heading\s*(\d+)", block.style.name, re.I):
|
if block.style and block.style.name and re.search(r"Heading\s*(\d+)", block.style.name, re.I):
|
||||||
try:
|
try:
|
||||||
level_match = re.search(r"(\d+)", block.style.name)
|
level_match = re.search(r"(\d+)", block.style.name)
|
||||||
if level_match:
|
if level_match:
|
||||||
|
|||||||
Reference in New Issue
Block a user