Skip to content

Commit 479330c

Browse files
authored
refactor: use collection id in download search_by_id (#44)
use the collection id coming from the download request in the search_by_id sent to the eodag server to avoid having search metrics with the eodag product type
1 parent b608a7c commit 479330c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

stac_fastapi/eodag/extensions/data_download.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ def get_data(
107107

108108
# check if the collection is known
109109
try:
110-
product_type = dag.get_product_type_from_alias(collection_id)
110+
dag.get_product_type_from_alias(collection_id)
111111
except NoMatchingProductType as e:
112112
raise NotFoundError(e) from e
113113

114-
search_results = dag.search(id=item_id, productType=product_type, provider=federation_backend)
114+
search_results = dag.search(id=item_id, productType=collection_id, provider=federation_backend)
115115
if len(search_results) > 0:
116116
product = cast(EOProduct, search_results[0])
117117

118118
else:
119119
raise NotFoundError(
120-
f"Could not find {item_id} item in {product_type} collection",
120+
f"Could not find {item_id} item in {collection_id} collection",
121121
f" for backend {federation_backend}.",
122122
)
123123

0 commit comments

Comments
 (0)