Commit 688528f3 authored by Jérome Perrin's avatar Jérome Perrin

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
parent cf3a1033
...@@ -126,6 +126,8 @@ class PDFDocument(Image, ConversionCacheMixin): ...@@ -126,6 +126,8 @@ class PDFDocument(Image, ConversionCacheMixin):
""" """
Convert the PDF text content to text with pdftotext Convert the PDF text content to text with pdftotext
""" """
if not self.data:
return ''
tmp = tempfile.NamedTemporaryFile() tmp = tempfile.NamedTemporaryFile()
tmp.write(_unpackData(self.data)) tmp.write(_unpackData(self.data))
tmp.seek(0) tmp.seek(0)
...@@ -144,6 +146,8 @@ class PDFDocument(Image, ConversionCacheMixin): ...@@ -144,6 +146,8 @@ class PDFDocument(Image, ConversionCacheMixin):
NOTE: XXX check that command exists and was executed NOTE: XXX check that command exists and was executed
successfully successfully
""" """
if not self.data:
return ''
tmp = tempfile.NamedTemporaryFile() tmp = tempfile.NamedTemporaryFile()
tmp.write(_unpackData(self.data)) tmp.write(_unpackData(self.data))
tmp.seek(0) tmp.seek(0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment