From a51ec07c6bdf9b5e0ba9a9c82d65dd2dd4de7546 Mon Sep 17 00:00:00 2001 From: Nathan Cutler Date: Wed, 13 Nov 2019 11:37:15 +0100 Subject: [PATCH] backport-resolve-issue: narrow regular expression The regular expression used to extract tracker URLs from the PR body was too generous. When there are two URLs on the same line and the second is a tracker URl, the regex picked up both of them. For example, the following string matched the regex: "https://github.com/ceph/ceph/pull/26538, https://tracker.ceph.com/issues/41452" This commit fixes the issue. Signed-off-by: Nathan Cutler --- src/script/backport-resolve-issue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/backport-resolve-issue b/src/script/backport-resolve-issue index 2b4626595c1..a089aca3ed5 100755 --- a/src/script/backport-resolve-issue +++ b/src/script/backport-resolve-issue @@ -393,7 +393,7 @@ Ceph version: base {}, target {}'''.format(self.github_url, pr_title_trunc, # for bt in self.backport_trackers: # does the Backport Tracker description link back to the GitHub PR? - p = re.compile('http.*://github.com/ceph/ceph/pull/\\d+') + p = re.compile('http.?://github.com/ceph/ceph/pull/\\d+') bt.tracker_description = bt.redmine_issue.description bt.github_url_from_tracker = None try: @@ -487,7 +487,7 @@ Ceph version: base {}, target {}'''.format(self.github_url, pr_title_trunc, def extract_backport_trackers_from_github_pr_desc(self): global redmine_endpoint - p = re.compile('http.*://tracker.ceph.com/issues/\\d+') + p = re.compile('http.?://tracker.ceph.com/issues/\\d+') matching_strings = p.findall(self.github_pr_desc) if not matching_strings: print_outer_divider() -- 2.39.5