From 79f6a54d00512dd5cbf697bd8250ee1649b02591 Mon Sep 17 00:00:00 2001 From: khaledk2 Date: Mon, 2 Dec 2024 21:33:20 +0000 Subject: [PATCH] fix issue #104 --- omero_search_engine/api/v1/resources/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/omero_search_engine/api/v1/resources/utils.py b/omero_search_engine/api/v1/resources/utils.py index 2af31430..6f01a3aa 100644 --- a/omero_search_engine/api/v1/resources/utils.py +++ b/omero_search_engine/api/v1/resources/utils.py @@ -1040,8 +1040,13 @@ def search_resource_annotation( return query_string search_omero_app.logger.info("Query %s" % query_string) - query = json.loads(query_string, strict=False) - raw_query_to_send_back = json.loads(query_string, strict=False) + from ast import literal_eval + + try: + query = literal_eval(query_string) + raw_query_to_send_back = literal_eval(query_string) + except Exception as ex: + raise Exception("Failed to load the query, error: %s" % str(ex)) else: query = raw_elasticsearch_query raw_query_to_send_back = copy.copy(raw_elasticsearch_query)