From 2c67e840be5af7900ab61a5a04bb42bffc71c678 Mon Sep 17 00:00:00 2001
From: Yusei Tahara <yusei@nexedi.com>
Date: Fri, 7 Sep 2007 08:19:57 +0000
Subject: [PATCH] if document is empty, don't try to convert. oood does not
 work for empty data, so it is waste of time.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16148 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5OOo/Document/OOoDocument.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/product/ERP5OOo/Document/OOoDocument.py b/product/ERP5OOo/Document/OOoDocument.py
index 66950f90cf..de375f09dd 100644
--- a/product/ERP5OOo/Document/OOoDocument.py
+++ b/product/ERP5OOo/Document/OOoDocument.py
@@ -312,6 +312,11 @@ class OOoDocument(File, ConversionCacheMixin):
     If a conversion is already stored for this format, it is returned
     directly, otherwise the conversion is stored for the next time.
     """
+    #XXX if document is empty, stop to try to convert.
+    #XXX but I don't know what is a appropriate mime-type.(Yusei)
+    if self.get_size()==0:
+      return 'text/plain', ''
+    
     # Make sure we can support html and pdf by default
     is_html = 0
     original_format = format
-- 
2.30.9