Don't call office converter if not initialized
This commit is contained in:
+10
-8
@@ -50,17 +50,19 @@ def convert(input_filepath, output_filepath=None, cleanup_files=False, mimetype=
|
|||||||
|
|
||||||
if os.path.exists(output_filepath):
|
if os.path.exists(output_filepath):
|
||||||
return output_filepath
|
return output_filepath
|
||||||
|
|
||||||
office_converter.convert(input_filepath, mimetype=mimetype)
|
|
||||||
if office_converter:
|
if office_converter:
|
||||||
try:
|
try:
|
||||||
input_filepath = office_converter.output_filepath
|
office_converter.convert(input_filepath, mimetype=mimetype)
|
||||||
mimetype = 'application/pdf'
|
if office_converter.exists:
|
||||||
|
input_filepath = office_converter.output_filepath
|
||||||
|
mimetype = 'application/pdf'
|
||||||
|
else:
|
||||||
|
# Recycle the already detected mimetype
|
||||||
|
mimetype = office_converter.mimetype
|
||||||
|
|
||||||
except OfficeConverter:
|
except OfficeConverter:
|
||||||
raise UnknownFileFormat('office converter exception')
|
raise UnknownFileFormat('office converter exception')
|
||||||
else:
|
|
||||||
# Recycle the already detected mimetype
|
|
||||||
mimetype = office_converter.mimetype
|
|
||||||
|
|
||||||
if size:
|
if size:
|
||||||
transformations.append(
|
transformations.append(
|
||||||
|
|||||||
Reference in New Issue
Block a user