Skip to content

Fix pdfoxide parser TypeError on None return from extract_text - #28

Open
rager306 wants to merge 1 commit into
mainfrom
fix-pdfoxide-none-return-bug-7499723028510886025
Open

Fix pdfoxide parser TypeError on None return from extract_text#28
rager306 wants to merge 1 commit into
mainfrom
fix-pdfoxide-none-return-bug-7499723028510886025

Conversation

@rager306

@rager306 rager306 commented Feb 3, 2026

Copy link
Copy Markdown
Owner

Fixed a bug in pdfparser/pdfoxide_parser.py where doc.extract_text(page_num) could return None (commented out fallback was ignored), leading to a TypeError when concatenating strings. Also synchronized requirements.txt by adding the missing pdf-oxide dependency and added a regression test to prevent recurrence.


PR created automatically by Jules for task 7499723028510886025 started by @rager306

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved stability of PDF text extraction by fixing handling of edge cases that previously caused processing errors during text concatenation.
  • Tests

    • Added regression tests to verify robust handling of various PDF parsing scenarios and ensure reliable processing across different input conditions.

- Updated `pdfparser/pdfoxide_parser.py` to handle `None` return from `extract_text` by defaulting to empty string.
- Added `pdf-oxide>=0.2.2` to `requirements.txt` to sync with `pyproject.toml`.
- Added regression test `tests/test_pdfoxide_edge_cases.py` to verify the fix.

Co-authored-by: rager306 <248269686+rager306@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Feb 3, 2026

Copy link
Copy Markdown

Walkthrough

This pull request fixes a potential TypeError during PDF text extraction by safely coalescing None returns to empty strings, adds the pdf-oxide dependency to requirements, and introduces regression tests for the edge case where extract_text returns None.

Changes

Cohort / File(s) Summary
Bug Fix
pdfparser/pdfoxide_parser.py
Modified per-page text extraction to safely handle None return values using the or "" pattern, preventing TypeError during string concatenation and ensuring robust text accumulation.
Dependency Addition
requirements.txt
Added pdf-oxide>=0.2.2 as a new dependency to the Python requirements.
Regression Tests
tests/test_pdfoxide_edge_cases.py
Added new test module with edge case coverage for PDF parsing, specifically testing graceful handling when extract_text returns None on non-metadata pages, verifying correct account number parsing, transaction list presence, and full text accumulation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main fix: resolving a TypeError in the pdfoxide parser when extract_text returns None, which is the primary change across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-pdfoxide-none-return-bug-7499723028510886025

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant