From 9b41a43ead3fda6ba400972bfb481442948ef94d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 17 2018 12:48:09 +0000 Subject: Adjust the FIXES regex so they cover project having a dash in their name Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/lib/link.py b/pagure/lib/link.py index 5a61218..f200198 100644 --- a/pagure/lib/link.py +++ b/pagure/lib/link.py @@ -19,15 +19,15 @@ import pagure.exceptions FIXES = [ re.compile(r'(?:.*\s+)?fixe?[sd]?:?\s*?#(\d+)', re.I), re.compile( - r'(?:.*\s+)?fixe?[sd]?:?\s*?https?://.*/(\w+)' + r'(?:.*\s+)?fixe?[sd]?:?\s*?https?://.*/([a-zA-z0-9_][a-zA-Z0-9-_]*)' '/(?:issue|pull-request)/(\d+)', re.I), re.compile(r'(?:.*\s+)?merge?[sd]?:?\s*?#(\d+)', re.I), re.compile( - r'(?:.*\s+)?merge?[sd]?:?\s*?https?://.*/(\w+)' + r'(?:.*\s+)?merge?[sd]?:?\s*?https?://.*/([a-zA-z0-9_][a-zA-Z0-9-_]*)' '/(?:issue|pull-request)/(\d+)', re.I), re.compile(r'(?:.*\s+)?close?[sd]?:?\s*?#(\d+)', re.I), re.compile( - r'(?:.*\s+)?close?[sd]?:?\s*?https?://.*/(\w+)' + r'(?:.*\s+)?close?[sd]?:?\s*?https?://.*/([a-zA-z0-9_][a-zA-Z0-9-_]*)' '/(?:issue|pull-request)/(\d+)', re.I), ] diff --git a/tests/test_pagure_lib_link.py b/tests/test_pagure_lib_link.py index 4dcb4ab..b85c2d5 100644 --- a/tests/test_pagure_lib_link.py +++ b/tests/test_pagure_lib_link.py @@ -265,6 +265,8 @@ class PagureLibLinktests(tests.Modeltests): ('test', '123')) project_match('Merge: http://localhost/fork/pingou/test/issue/1234#foo', ('test', '1234')) + project_match('Merges: https://localhost/SSSD/ding-libs/pull-request/3188', + ('ding-libs', '3188')) # issue matches def issue_match(text, issue):