|
38 | 38 | from stac_fastapi.types.rfc3339 import str_to_interval |
39 | 39 | from stac_fastapi.types.search import BaseSearchPostRequest |
40 | 40 | from stac_fastapi.types.stac import Collection, Collections, Item, ItemCollection |
41 | | -from stac_pydantic.links import Links, Relations |
| 41 | +from stac_pydantic.links import Relations |
42 | 42 | from stac_pydantic.shared import MimeTypes |
43 | 43 |
|
44 | 44 | from eodag import EOProduct, SearchResult |
@@ -154,8 +154,11 @@ def has_ecmwf_search_plugin(federation_backends, request): |
154 | 154 | ): |
155 | 155 | extension_names.remove("CollectionOrderExtension") |
156 | 156 |
|
157 | | - extra_links = (collection.links or Links([])).root |
158 | | - extended_coll_links = Links(extended_collection.get("links", [])).root |
| 157 | + if collection.links: |
| 158 | + extra_links = [link.model_dump() for link in collection.links.root] |
| 159 | + else: |
| 160 | + extra_links = [] |
| 161 | + extended_coll_links = extended_collection.get("links", []) |
159 | 162 | extended_collection["links"] = CollectionLinks( |
160 | 163 | collection_id=extended_collection["id"], |
161 | 164 | request=request, |
@@ -411,7 +414,7 @@ async def item_collection( |
411 | 414 | item_collection = self._search_base(search_request, request) |
412 | 415 | extension_names = [type(ext).__name__ for ext in self.extensions] |
413 | 416 | links = ItemCollectionLinks(collection_id=collection_id, request=request).get_links( |
414 | | - extensions=extension_names, extra_links=Links(item_collection["links"]).root |
| 417 | + extensions=extension_names, extra_links=item_collection["links"] |
415 | 418 | ) |
416 | 419 | item_collection["links"] = links |
417 | 420 | return item_collection |
|
0 commit comments