Merge pull request #286 from taigaio/Fixing-empty-body-bug-in-github-webhooks

Fixing empty body bug in github webhooks
remotes/origin/enhancement/email-actions
David Barragán Merino 2015-03-18 14:42:37 +01:00
commit 59869b68f8
2 changed files with 4 additions and 0 deletions

View File

@ -91,6 +91,9 @@ class PushEventHook(BaseEventHook):
def replace_github_references(project_url, wiki_text):
if wiki_text == None:
wiki_text = ""
template = "\g<1>[GitHub#\g<2>]({}/issues/\g<2>)\g<3>".format(project_url)
return re.sub(r"(\s|^)#(\d+)(\s|$)", template, wiki_text, 0, re.M)

View File

@ -455,3 +455,4 @@ def test_replace_github_references():
assert event_hooks.replace_github_references("project-url", " #2 ") == " [GitHub#2](project-url/issues/2) "
assert event_hooks.replace_github_references("project-url", " #2") == " [GitHub#2](project-url/issues/2)"
assert event_hooks.replace_github_references("project-url", "#test") == "#test"
assert event_hooks.replace_github_references("project-url", None) == ""