Skip to content

Commit

Permalink
Fixing empty body bug in github webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
superalex committed Mar 18, 2015
1 parent a1e2a94 commit 3877411
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions taiga/hooks/github/event_hooks.py
Expand Up @@ -91,6 +91,9 @@ def _change_status(self, ref, status_slug, github_user):


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)

Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_hooks_github.py
Expand Up @@ -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) == ""

0 comments on commit 3877411

Please sign in to comment.