Fixing empty body bug in github webhooks

remotes/origin/enhancement/email-actions
Alejandro Alonso 2015-03-18 13:52:56 +01:00
parent a1e2a9457e
commit 3877411c41
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): 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) 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) 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", " #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", "#test") == "#test"
assert event_hooks.replace_github_references("project-url", None) == ""