In ExportToModel workflow, for model_file attribute, check the content type first before checking the file extension
Also test if base_filename is not None.
This commit is contained in:
parent
ac72dfb6f5
commit
b83dde334f
|
@ -835,8 +835,12 @@ class ExportToModel(WorkflowStatusItem):
|
|||
return formdata.get_url() + self.get_directory_name()
|
||||
|
||||
def model_file_validation(self, upload):
|
||||
if upload.base_filename.endswith('.rtf'):
|
||||
if upload.content_type and upload.content_type == 'application/rtf':
|
||||
return True, ''
|
||||
if (upload.content_type and upload.content_type == 'application/octet-stream') or \
|
||||
upload.content_type is None:
|
||||
if upload.base_filename and upload.base_filename.endswith('.rtf'):
|
||||
return True, ''
|
||||
return False, _('Only RTF files can be used')
|
||||
|
||||
def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
|
||||
|
|
Loading…
Reference in New Issue