workflows: handle models as bytes (#36515)
This commit is contained in:
parent
dbbb116552
commit
e43bba68f5
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue