From 688528f396dfb07ecbde9f52985e320cec38ccbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Thu, 29 May 2008 11:49:23 +0000 Subject: [PATCH] if the PDF is empty, do not convert git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21218 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/PDFDocument.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/product/ERP5/Document/PDFDocument.py b/product/ERP5/Document/PDFDocument.py index 7cc0b94974..eb3c835386 100644 --- a/product/ERP5/Document/PDFDocument.py +++ b/product/ERP5/Document/PDFDocument.py @@ -126,6 +126,8 @@ class PDFDocument(Image, ConversionCacheMixin): """ Convert the PDF text content to text with pdftotext """ + if not self.data: + return '' tmp = tempfile.NamedTemporaryFile() tmp.write(_unpackData(self.data)) tmp.seek(0) @@ -144,6 +146,8 @@ class PDFDocument(Image, ConversionCacheMixin): NOTE: XXX check that command exists and was executed successfully """ + if not self.data: + return '' tmp = tempfile.NamedTemporaryFile() tmp.write(_unpackData(self.data)) tmp.seek(0) -- 2.30.9