Skip to content

Commit

Permalink
Quote project key (#46)
Browse files Browse the repository at this point in the history
For wider compatibility with project keys such as "SET", quote the key
in the SQL expression.

Signed-off-by: Nicolas Bock <[email protected]>
  • Loading branch information
nicolasbock authored Jul 29, 2024
1 parent d5f4cc0 commit 7a36fb6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion github_jira_sync_app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ async def bot(request: Request, payload: dict = Body(...)):
jira = JIRA(jira_instance_url, basic_auth=(jira_username, jira_token))
jira_task_desc_match = f"This issue was created from GitHub Issue {issue.html_url}"
existing_issues = jira.search_issues(
rf'project={settings["jira_project_key"]} AND description ~"\"{jira_task_desc_match}\""',
rf'project="{settings["jira_project_key"]}" AND '
+ rf'description ~"\"{jira_task_desc_match}\""',
json_result=False,
)
assert isinstance(existing_issues, list), "Jira did not return a list of existing issues"
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/url_responses/issue_labeled_correct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ responses:
content_type: text/plain
method: GET
status: 200
url: https://my-jira.atlassian.net/rest/api/2/search?jql=project%3DMTC+AND+description+~%22%5C%22This+issue+was+created+from+GitHub+Issue+https%3A%2F%2Fgithub.com%2Fbeliaev-maksim%2Ftest-ci%2Fissues%2F30%5C%22%22&startAt=0&validateQuery=True&fields=%2Aall&maxResults=50

url: https://my-jira.atlassian.net/rest/api/2/search?jql=project%3D%22MTC%22+AND+description+~%22%5C%22This+issue+was+created+from+GitHub+Issue+https%3A%2F%2Fgithub.com%2Fbeliaev-maksim%2Ftest-ci%2Fissues%2F30%5C%22%22&startAt=0&validateQuery=True&fields=%2Aall&maxResults=50
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ responses:
content_type: text/plain
method: GET
status: 200
url: https://my-jira.atlassian.net/rest/api/2/search?jql=project%3DMTC+AND+description+~%22%5C%22This+issue+was+created+from+GitHub+Issue+https%3A%2F%2Fgithub.com%2Fbeliaev-maksim%2Ftest-ci%2Fissues%2F30%5C%22%22&startAt=0&validateQuery=True&fields=%2Aall&maxResults=50

url: https://my-jira.atlassian.net/rest/api/2/search?jql=project%3D%22MTC%22+AND+description+~%22%5C%22This+issue+was+created+from+GitHub+Issue+https%3A%2F%2Fgithub.com%2Fbeliaev-maksim%2Ftest-ci%2Fissues%2F30%5C%22%22&startAt=0&validateQuery=True&fields=%2Aall&maxResults=50

0 comments on commit 7a36fb6

Please sign in to comment.