diff --git a/services/catalog/rs_server_catalog/user_catalog.py b/services/catalog/rs_server_catalog/user_catalog.py index f9448947c..5243fbdeb 100644 --- a/services/catalog/rs_server_catalog/user_catalog.py +++ b/services/catalog/rs_server_catalog/user_catalog.py @@ -542,6 +542,12 @@ async def manage_search_request( # pylint: disable=too-many-statements,too-many if not await self.collection_exists(request, collection): content["collections"][i] = f"{self.request_ids['owner_id']}_{collection}" logger.debug(f"Using collection name: {content['collections'][i]}") + # Check the existence of the collection after concatenation of owner_id + if not await self.collection_exists(request, content["collections"][i]): + raise log_http_exception( + status_code=HTTP_404_NOT_FOUND, + detail=f"Collection {collection} not found.", + ) self.request_ids["collection_ids"] = content["collections"] request = self.override_request_body(request, content) @@ -571,6 +577,13 @@ async def manage_search_request( # pylint: disable=too-many-statements,too-many for i, collection in enumerate(coll_list): if not await self.collection_exists(request, collection): coll_list[i] = f"{self.request_ids['owner_id']}_{collection}" + logger.debug(f"Using collection name: {coll_list[i]}") + # Check the existence of the collection after concatenation of owner_id + if not await self.collection_exists(request, coll_list[i]): + raise log_http_exception( + status_code=HTTP_404_NOT_FOUND, + detail=f"Collection {collection} not found.", + ) self.request_ids["collection_ids"] = coll_list query_params_dict["collections"] = ",".join(coll_list)