mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
metadata: Do not raise an exception if a PDF file has empty metadata
Check explicitly for `info is None`, since an empty dict also evaluates to false. Otherwise it raises an exception when there is no metadata, and prevents from generating the cover. This has started to happen recently with some arxiv PDF's, like this one: https://arxiv.org/pdf/1605.02391v2
This commit is contained in:
parent
62a5d9c4d2
commit
432aa7e21d
@ -95,7 +95,7 @@ def get_metadata(stream, cover=True):
|
||||
raw = f.read().strip()
|
||||
if raw:
|
||||
prints(raw)
|
||||
if not info:
|
||||
if info is None:
|
||||
raise ValueError('Could not read info dict from PDF')
|
||||
covpath = os.path.join(pdfpath, 'cover.jpg')
|
||||
cdata = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user