Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support zipped bands in s3 #62

Merged
merged 1 commit into from
Jul 18, 2024
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
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")
Loading