← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-webhook-client-deliver-secret into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-webhook-client-deliver-secret into launchpad:master.

Commit message:
Don't encode secret for IWebhookClient.deliver

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398019

create_request also encodes the secret, and on Python 3 we need to only do that once.  It makes more sense to encode it only at the network boundary.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-webhook-client-deliver-secret into launchpad:master.
diff --git a/lib/lp/services/webhooks/model.py b/lib/lp/services/webhooks/model.py
index d2ae96f..f26fa73 100644
--- a/lib/lp/services/webhooks/model.py
+++ b/lib/lp/services/webhooks/model.py
@@ -608,8 +608,8 @@ class WebhookDeliveryJob(WebhookJobDerived):
         secret = self.webhook.secret
         result = getUtility(IWebhookClient).deliver(
             self.webhook.delivery_url, config.webhooks.http_proxy,
-            user_agent, 30, secret.encode('utf-8') if secret else None,
-            str(self.job_id), self.event_type, self.payload)
+            user_agent, 30, secret, str(self.job_id), self.event_type,
+            self.payload)
         # Request and response headers and body may be large, so don't
         # store them in the frequently-used JSON. We could store them in
         # the librarian if we wanted them in future.