From 3877411c412435df5460db01b95dfe32489e9671 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 18 Mar 2015 13:52:56 +0100 Subject: [PATCH] Fixing empty body bug in github webhooks --- taiga/hooks/github/event_hooks.py | 3 +++ tests/integration/test_hooks_github.py | 1 + 2 files changed, 4 insertions(+) diff --git a/taiga/hooks/github/event_hooks.py b/taiga/hooks/github/event_hooks.py index 8123bf00..50c465c5 100644 --- a/taiga/hooks/github/event_hooks.py +++ b/taiga/hooks/github/event_hooks.py @@ -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) diff --git a/tests/integration/test_hooks_github.py b/tests/integration/test_hooks_github.py index 6d85cca4..32412d0b 100644 --- a/tests/integration/test_hooks_github.py +++ b/tests/integration/test_hooks_github.py @@ -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) == ""