pdf-redactor icon indicating copy to clipboard operation
pdf-redactor copied to clipboard

Missing metadata isn't handled.

Open djaychela opened this issue 7 years ago • 1 comments

When applying the example.py script to some PDF files, I've been getting errors -

"Title": [lambda value: value.upper()], AttributeError: 'NoneType' object has no attribute 'upper'

I've found what I think is a simple fix for this - checking if the value is None in line 155 of pdf_redactor.py:

# Filter the value. if value is not None: value = f(value)

Not sure about the etiquette of submitting a PR, but would like to do so - this has fixed the issues I've had when working on a number of PDFs using redactor.

djaychela avatar Apr 17 '19 08:04 djaychela

Hi. I appreciate you hunting down your issue.

But the change would change the functionality of the library. I'd suggest changing your lambda function instead to e.g. value.upper() if value else None.

JoshData avatar May 12 '19 17:05 JoshData