Skip to content

ROB: Do not crash on an outline action without a type - #4098

Merged
stefan6419846 merged 2 commits into
py-pdf:mainfrom
RavSinghChandan:outline-action-missing-s
Sep 23, 2026
Merged

stefan6419846 merged 2 commits into
py-pdf:mainfrom
RavSinghChandan:outline-action-missing-s

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

_build_outline_item subscripts the action type directly:

action_type = cast(NameObject, action[GoToActionArguments.S])

/S is required by the spec, but a file that omits it takes down reader.outline
with a bare KeyError: '/S' rather than a message naming the problem.

The lookup now follows the handling already used for /Title and /D in the same
function: strict mode raises PdfReadError naming the missing attribute, and
lenient mode falls through to the destination-less path, so the item keeps its
title instead of the whole outline failing.

Offline suite passes, 1366 tests.

Used Claude (Opus) to help locate and patch this; I reviewed and tested the change.

@codecov

codecov Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.10%. Comparing base (ca60531) to head (e786279).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4098   +/-   ##
=======================================
  Coverage   98.09%   98.10%           
=======================================
  Files          59       59           
  Lines       11521    11565   +44     
  Branches     2151     2164   +13     
=======================================
+ Hits        11302    11346   +44     
+ Misses        125      124    -1     
- Partials       94       95    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread tests/test_doc_common.py Resolved
@stefan6419846
stefan6419846 merged commit e0712a8 into py-pdf:main Sep 23, 2026
31 of 34 checks passed
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.

2 participants