From 85c337bca6a986738426d902140c0cf3727c04cc Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 18 2015 14:16:06 +0000 Subject: [PATCH 1/2] Fix sending the payload to the web-hook(s) Sending the data as a dict does not end well, it's like only the keys were sent. With this change, the whole message is converted to a JSON blob and sent allowing the all the data to reach the destination. --- diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index 6a15fe5..4fc18e5 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -81,7 +81,7 @@ def log(project, topic, msg): req = requests.post( url, headers=headers, - data={'payload': msg} + data={'payload': flask.json.dumps(msg)} ) if not req: raise pagure.exceptions.PagureException( From 5b844eb5199370acf065df9ad3688aa1ace24889 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 18 2015 14:18:34 +0000 Subject: [PATCH 2/2] Do the JSON conversion once for all hooks --- diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index 4fc18e5..f69863c 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -75,13 +75,14 @@ def log(project, topic, msg): 'X-Pagure-Topic': topic, 'X-Pagure-Signature': hashhex } + msg = flask.json.dumps(msg) for url in project.settings.get('Web-hooks').split('\n'): url = url.strip() try: req = requests.post( url, headers=headers, - data={'payload': flask.json.dumps(msg)} + data={'payload': msg} ) if not req: raise pagure.exceptions.PagureException(