[Git][reproducible-builds/diffoscope][master] 2 commits: Display the reason when cannot extract metadata from PDF files.

Chris Lamb gitlab at salsa.debian.org
Fri Nov 9 18:42:36 CET 2018


Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
cf3bc340 by Chris Lamb at 2018-11-09T17:38:23Z
Display the reason when cannot extract metadata from PDF files.

- - - - -
96243190 by Chris Lamb at 2018-11-09T17:41:58Z
Prevent tracebacks when obtaining PDF metadata from files with multiple PDF dictionary definition entries. (Closes: #913315)

- - - - -


1 changed file:

- diffoscope/comparators/pdf.py


Changes:

=====================================
diffoscope/comparators/pdf.py
=====================================
@@ -63,11 +63,12 @@ class PdfFile(File):
     def dump_pypdf2_metadata(file):
         try:
             pdf = PyPDF2.PdfFileReader(file.path)
-        except PyPDF2.utils.PdfReadError:
-            return "(Could not extract metadata)"
+            document_info = pdf.getDocumentInfo()
+        except PyPDF2.utils.PdfReadError as exc:
+            return "(Could not extract metadata: {})".format(exc)
 
         xs = []
-        for k, v in sorted(pdf.getDocumentInfo().items()):
+        for k, v in sorted(document_info.items()):
             xs.append("{}: {!r}".format(k.lstrip('/'), v))
 
         return "\n".join(xs)



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/16d519a9a1f77f45ea8ab5464f1b960db0d16983...9624319001171a59e8de0f220cedd71fcebf7ee9

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/16d519a9a1f77f45ea8ab5464f1b960db0d16983...9624319001171a59e8de0f220cedd71fcebf7ee9
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20181109/7247e94c/attachment.html>


More information about the rb-commits mailing list