Unexpected KeyError when using scrub with fitz_new (original) (raw)
Describe the bug (mandatory)
The following script causes a KeyError when applied to the attached PDF: bug.pdf
import fitz_new as fitz pdf = fitz.open("bug.pdf") pdf.scrub()
The exception received on the last line is:
./venv/lib64/python3.12/site-packages/fitz_new/__init__.py:54:exception_info: exception_info:
Traceback (most recent call last):
File "./venv/lib64/python3.12/site-packages/fitz_new/__init__.py", line 8433, in finished
linkobj = self._annot_refs[linkid]
~~~~~~~~~~~~~~~~^^^^^^^^
File "/usr/lib64/python3.12/weakref.py", line 136, in __getitem__
o = self.data[key]()
~~~~~~~~~^^^^^
KeyError: ''
The trigger seems to be an email URL in the PDF document bug.pdf.
To Reproduce (mandatory)
See above
Expected behavior (optional)
scrub should run without KeyError, I assume.
Screenshots (optional)
Not applicable
Your configuration (mandatory)
- Operating system, potentially version and bitness: Fedora Linux 39 (Workstation Edition), 12th Gen Intel® Core™ i7-1260P × 16
uname -a:Linux molmod47 6.5.11-300.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 8 22:37:57 UTC 2023 x86_64 GNU/Linux- Python version, bitness: Python 3.12.0 (main, Oct 2 2023, 00:00:00) [GCC 13.2.1 20230918 (Red Hat 13.2.1-3)] on linux (python3-3.12.0-1.fc39.x86_64.rpm)
- PyMuPDF version, installation method: generated from source, development version from main branch 4d02522