From 690f50de1c0f56dd49558c38de8aac213a658672 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Thu, 26 Dec 2013 18:34:40 -0600 Subject: [PATCH] pdf/processing: avoid possible dead goblin if pdfinfo failed --- mediagoblin/media_types/pdf/processing.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mediagoblin/media_types/pdf/processing.py b/mediagoblin/media_types/pdf/processing.py index 6fb0b782..4dd894d8 100644 --- a/mediagoblin/media_types/pdf/processing.py +++ b/mediagoblin/media_types/pdf/processing.py @@ -210,6 +210,11 @@ def pdf_info(original): info_dict = dict([[part.strip() for part in l.strip().split(':', 1)] for l in lines if ':' in l]) + if 'Page size' not in info_dict.keys(): + # TODO - message is for the user, not debug, but BadMediaFail not taking an argument, fix that. + _log.debug('Missing "Page size" key in returned pdf - conversion failed?') + raise BadMediaFail() + for date_key in [('pdf_mod_date', 'ModDate'), ('pdf_creation_date', 'CreationDate')]: if date_key in info_dict: -- 2.25.1