Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions geonode/upload/handlers/xlsx/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,13 @@ def pre_processing(self, files, execution_id, **kwargs):
# Note: rows_gen continues from the row after the headers
self._convert_to_csv(headers, rows_gen, output_file)

except InvalidInputFileException as e:
logger.exception(f"XLSX Pre-processing failed: {e}")
raise

except Exception as e:
logger.exception("XLSX Pre-processing failed")
raise InvalidInputFileException(detail=f"Failed to securely parse Excel: {str(e)}")
logger.exception(f"XLSX Pre-processing failed: {e}")
raise InvalidInputFileException(detail="Failed to parse Excel.")

# update the file path in the payload
_data["files"]["base_file"] = output_file
Expand Down
3 changes: 1 addition & 2 deletions geonode/upload/handlers/xlsx/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def test_pre_processing_fails_on_missing_lat(self, mock_get_exec):
):
with self.assertRaises(InvalidInputFileException) as context:
self.handler.pre_processing(files, exec_id)

self.assertIn("geometry headers", str(context.exception))

@patch("geonode.upload.orchestrator.orchestrator.get_execution_object")
Expand Down Expand Up @@ -158,7 +157,7 @@ def test_security_billion_laughs_protection(self):
with self.assertRaises(InvalidInputFileException) as context:
self.handler.pre_processing(files, exec_id)

self.assertIn("Failed to securely parse Excel", str(context.exception))
self.assertIn("Failed to parse Excel", str(context.exception))
finally:
if os.path.exists(malicious_path):
os.remove(malicious_path)
Loading