Skip to content

Commit

Permalink
fix: support zipped bands in s3 (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato authored Jul 18, 2024
1 parent 2636ace commit 04bcc98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion eodag_cube/api/product/_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def _get_rio_env(self, dataset_address: str) -> Dict[str, Any]:
:rtype: Dict[str, Any]
"""
product_location_scheme = dataset_address.split("://")[0]
if product_location_scheme == "s3" and hasattr(
if "s3" in product_location_scheme and hasattr(
self.downloader, "get_product_bucket_name_and_prefix"
):
bucket_name, prefix = self.downloader.get_product_bucket_name_and_prefix(
Expand Down
8 changes: 8 additions & 0 deletions tests/units/test_eoproduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,11 @@ def test_get_rio_env(self):
self.assertEqual(rio_env["AWS_HTTPS"], "YES")
self.assertEqual(rio_env["AWS_S3_ENDPOINT"], "some.where")
self.assertEqual(rio_env["AWS_VIRTUAL_HOSTING"], "FALSE")

# aws s3 with custom endpoint and band in zip
rio_env = product._get_rio_env("zip+s3://path/to/asset.zip!band.tiff")
self.assertEqual(len(rio_env), 4)
self.assertIsInstance(rio_env["session"], AWSSession)
self.assertEqual(rio_env["AWS_HTTPS"], "YES")
self.assertEqual(rio_env["AWS_S3_ENDPOINT"], "some.where")
self.assertEqual(rio_env["AWS_VIRTUAL_HOSTING"], "FALSE")

0 comments on commit 04bcc98

Please sign in to comment.