diff --git a/lib/core/agent.py b/lib/core/agent.py index b6d7a5f0a..3f2ce3eed 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -201,7 +201,7 @@ class Agent(object): else: query = kb.injection.prefix or prefix or "" - if not (expression and expression[0] == ";"): + if not (expression and expression[0] == ';') and not (query and query[-1] in ('(', ')') and expression and expression[0] in ('(', ')')): query += " " query = "%s%s" % (query, expression)