I am trying to write a JIRA query to query a bunch of defects. The problem I am having is that if there is a JQL keyword in the list of defects I am querying, the entire query fails and spits out the following error:
JiraError HTTP 400 - text: Error in the JQL Query: 'update' is a reserved JQL word.
You must surround it in quotation marks to use it in a query.
My query:
jira.search_issues( 'key in ({})'.format(','.join(defects))),
validate_query=false,
maxResults = MAX_JIRA_RESULTS )
This fails when a defect contains the word: 'update'. Now it is a bad data error, but I want to make sure the query is tolerant to malicious input.
Now the only way I can think of to make sure this bug never happens again is to make sure each defect that contains a JIRA keyword has that keyword escaped. This is obviously pretty tedious and is subject to fail if any new JQL keywords are added.
So is there a better way to do this other than escaping each JIRA keyword I find in my string? Additionally, is there an easy way in Python to get the JIRA keywords?
Thanks!