Skip to content

Commit d0c8a38

Browse files
committed
small change
1 parent 8490c6f commit d0c8a38

File tree

1 file changed

+6
-5
lines changed
  • stac_fastapi/elasticsearch/stac_fastapi/elasticsearch

1 file changed

+6
-5
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/core.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ async def item_collection(
106106
collection = await self.get_collection(
107107
collection_id=collection_id, request=request
108108
)
109-
collection_id = collection.get("id")
110-
if collection_id is None:
109+
try:
110+
collection_id = collection["id"]
111+
except Exception:
111112
raise HTTPException(status_code=404, detail="Collection not found")
112113

113114
search = self.database.make_search()
@@ -312,10 +313,10 @@ async def post_search(
312313

313314
if hasattr(search_request, "filter"):
314315
cql2_filter = getattr(search_request, "filter", None)
315-
if filter_lang in [None, FilterLang.cql2_json, FilterLang.cql_json]:
316-
search = self.database.apply_cql2_filter(search, cql2_filter)
317-
else:
316+
if filter_lang == FilterLang.cql2_text:
318317
raise Exception("CQL2-Text is not supported with POST")
318+
else:
319+
search = self.database.apply_cql2_filter(search, cql2_filter)
319320

320321
sort = None
321322
if search_request.sortby:

0 commit comments

Comments
 (0)