Skip to content

Commit

Permalink
fix: change search base condition causing key error (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
smohiudd authored Feb 15, 2024
2 parents 2734b49 + 7111e48 commit d7a0a51
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
1 change: 0 additions & 1 deletion ingest_api/infrastructure/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ def build_api(
domain,
custom_host: Optional[str],
) -> aws_apigatewayv2_alpha.HttpApi:

integration_kwargs = dict(handler=handler)
if custom_host:
integration_kwargs[
Expand Down
1 change: 0 additions & 1 deletion routes/infrastructure/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def __init__(
stack_name = Stack.of(self).stack_name

if veda_route_settings.cloudfront:

# Certificate must be in zone us-east-1
domain_cert = (
certificatemanager.Certificate.from_certificate_arn(
Expand Down
39 changes: 21 additions & 18 deletions stac_api/runtime/src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,27 @@ async def _search_base(
result = await _super._search_base(search_request, **kwargs)

if len(result["features"]) > 0:
collection_id = result["features"][0]["collection"]
collection = await _super.get_collection(collection_id, request=request)

render_params = collection.get("renders", {})

if "dashboard" in render_params:
item_collection = ItemCollection(
**{
**result,
"features": [
self.inject_item_links(
i, render_params["dashboard"], request
)
for i in result.get("features", [])
],
}
)
else:
try:
collection_id = result["features"][0]["collection"]
collection = await _super.get_collection(collection_id, request=request)

render_params = collection.get("renders", {})

if "dashboard" in render_params:
item_collection = ItemCollection(
**{
**result,
"features": [
self.inject_item_links(
i, render_params["dashboard"], request
)
for i in result.get("features", [])
],
}
)
else:
item_collection = result
except Exception:
item_collection = result

return item_collection

0 comments on commit d7a0a51

Please sign in to comment.