# HG changeset patch
# User Marcin Kuzminski <marcin@rhodecode.com>
# Date 2018-02-06 15:35:46
# Node ID 51dda3260470e9aa39655be74d604e7beebec739
# Parent  47600b0329ce322c25f5dd66c05b99a28f36d59a

webhook: fixed extra variable replacement.

diff --git a/rhodecode/integrations/types/webhook.py b/rhodecode/integrations/types/webhook.py
--- a/rhodecode/integrations/types/webhook.py
+++ b/rhodecode/integrations/types/webhook.py
@@ -93,13 +93,14 @@ class WebhookHandler(object):
             'username': data['actor']['username'],
             'user_id': data['actor']['user_id']
         }
+
         extra_vars = {}
         for extra_key, extra_val in data['repo']['extra_fields'].items():
-            extra_vars['extra:{}'.format(extra_key)] = extra_val
+            extra_vars['extra__{}'.format(extra_key)] = extra_val
         common_vars.update(extra_vars)
 
-        return string.Template(
-            self.template_url).safe_substitute(**common_vars)
+        template_url = self.template_url.replace('${extra:', '${extra__')
+        return string.Template(template_url).safe_substitute(**common_vars)
 
     def repo_push_event_handler(self, event, data):
         url = self.get_base_parsed_template(data)