workflows: handle models as bytes (#36515)

This commit is contained in:
Frédéric Péters 2019-11-13 14:48:56 +01:00
parent dbbb116552
commit e43bba68f5
1 changed files with 2 additions and 2 deletions

View File

@ -118,7 +118,7 @@ def is_opendocument(stream):
try:
with zipfile.ZipFile(stream) as z:
if 'mimetype' in z.namelist():
return z.read('mimetype').startswith('application/vnd.oasis.opendocument.')
return z.read('mimetype').startswith(b'application/vnd.oasis.opendocument.')
except zipfile.BadZipfile:
return False
finally:
@ -245,7 +245,7 @@ class ExportToModel(WorkflowStatusItem):
upload.content_type is None:
if upload.base_filename and upload.base_filename.endswith('.rtf'):
return 'rtf'
if fp.read(10).startswith('{\\rtf'):
if fp.read(10).startswith(b'{\\rtf'):
fp.seek(0)
return 'rtf'
fp.seek(0)