Fix: Manual/Naive outline tuple unpack crash (#14518)

### What problem does this PR solve?

This fixes a crash in Manual and Naive parsing when PDF outlines include
page numbers as a third tuple value. It makes outline unpacking accept
extra values so parsing no longer fails. fixes #14411

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Idriss Sbaaoui
2026-04-30 11:55:02 +08:00
committed by GitHub
parent 71952b6b58
commit 9075872435
2 changed files with 2 additions and 2 deletions

View File

@@ -270,7 +270,7 @@ def chunk(filename, binary=None, from_page=0, to_page=MAXIMUM_PAGE_NUMBER, lang=
if res and pdf_parser and getattr(pdf_parser, "outlines", None):
res[0]["__outline__"] = [
{"title": title, "depth": depth}
for title, depth in pdf_parser.outlines
for title, depth, *_ in pdf_parser.outlines
]
return res

View File

@@ -1133,7 +1133,7 @@ def chunk(filename, binary=None, from_page=0, to_page=MAXIMUM_PAGE_NUMBER, lang=
if res and pdf_parser and getattr(pdf_parser, "outlines", None):
res[0]["__outline__"] = [
{"title": title, "depth": depth}
for title, depth in pdf_parser.outlines
for title, depth, *_ in pdf_parser.outlines
]
return res