Skip to content

fix: handle PDF pages with no extracted text before appending link an… - #13750

Open
MALLADISARMA wants to merge 2 commits into
deepset-ai:mainfrom
MALLADISARMA:fix/pypdf-null-page-text-links
Open

MALLADISARMA wants to merge 2 commits into
deepset-ai:mainfrom
MALLADISARMA:fix/pypdf-null-page-text-links

Conversation

@MALLADISARMA

Copy link
Copy Markdown
Contributor

Summary:
This fixes a bug in PyPDFToDocument where pages with no extracted text could crash during conversion when link_format was enabled. In those cases, page.extract_text() can return None, and the code tried to append link annotations to it as if it were a string.

What changed:

Normalize missing page text to an empty string before appending extracted links
Preserve link extraction for pages with no text
Add a regression test covering pages where text is absent but hyperlinks exist

Why:
This prevents TypeError crashes and allows PDF pages with valid annotations but no extractable text to be processed successfully instead of failing the whole conversion.

@MALLADISARMA
MALLADISARMA requested a review from a team as a code owner November 14, 2026 17:42
@MALLADISARMA
MALLADISARMA requested review from anakin87 and removed request for a team November 14, 2026 17:42
@vercel

vercel Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

@MALLADISARMA is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/converters
  pypdf.py
  haystack/core/pipeline
  pipeline.py
Project Total  

This report was generated by python-coverage-comment-action

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant