Skip to content

Commit

Permalink
Hot fix for exposure file content type "application/vnd.ms-excel" (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
sambles authored Sep 24, 2022
1 parent 378f0e9 commit cc29084
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/server/oasisapi/analyses/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,10 @@ def generate_inputs(self, initiator):
loc_lines = self.portfolio.location_file_len()
except Exception as e:
raise ValidationError(f"Failed to read location file size for chunking: {e}")
if isinstance(loc_lines, int):
if not isinstance(loc_lines, int):
errors['portfolio'] = [f'Failed to read "location_file" size, content_type={self.portfolio.location_file.content_type} might not be supported']

else:
if loc_lines < 1:
errors['portfolio'] = ['"location_file" must at least one row']
if errors:
Expand Down
3 changes: 2 additions & 1 deletion src/server/oasisapi/portfolios/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ def get_absolute_storage_url(self, request=None):
def location_file_len(self):
csv_compression_types = {
'text/csv': 'infer',
'application/vnd.ms-excel': 'infer',
'application/gzip': 'gzip',
'application/x-bzip2': 'bz2',
'application/zip': 'zip'
'application/zip': 'zip',
}
if not self.location_file:
return None
Expand Down

0 comments on commit cc29084

Please sign in to comment.