Skip to content

Commit

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


def replace_gitlab_references(project_url, wiki_text):
if wiki_text == None:
wiki_text = ""

template = "\g<1>[GitLab#\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_gitlab.py
Expand Up @@ -383,3 +383,4 @@ def test_replace_gitlab_references():
assert event_hooks.replace_gitlab_references("project-url", " #2 ") == " [GitLab#2](project-url/issues/2) "
assert event_hooks.replace_gitlab_references("project-url", " #2") == " [GitLab#2](project-url/issues/2)"
assert event_hooks.replace_gitlab_references("project-url", "#test") == "#test"
assert event_hooks.replace_gitlab_references("project-url", None) == ""

0 comments on commit fcd5ccb

Please sign in to comment.