From ef845926b127ff43ec744d89cc538991e02ec62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 17 Nov 2020 14:39:53 +0100 Subject: [PATCH] chg: Do not split a string into a list in complex query builder fix #597 --- pymisp/api.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index 1c41c06..f868a01 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -2915,11 +2915,20 @@ class PyMISP: '''Build a complex search query. MISP expects a dictionary with AND, OR and NOT keys.''' to_return = {} if and_parameters: - to_return['AND'] = [p for p in and_parameters if p] + if isinstance(and_parameters, str): + to_return['AND'] = [and_parameters] + else: + to_return['AND'] = [p for p in and_parameters if p] if not_parameters: - to_return['NOT'] = [p for p in not_parameters if p] + if isinstance(not_parameters, str): + to_return['NOT'] = [not_parameters] + else: + to_return['NOT'] = [p for p in not_parameters if p] if or_parameters: - to_return['OR'] = [p for p in or_parameters if p] + if isinstance(or_parameters, str): + to_return['OR'] = [or_parameters] + else: + to_return['OR'] = [p for p in or_parameters if p] return to_return # ## END Global helpers ###