]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(webhooks): fix crash when headers is null with header auth method
authorCôme Chilliet <come.chilliet@nextcloud.com>
Mon, 10 Jun 2024 14:26:59 +0000 (16:26 +0200)
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>
Tue, 11 Jun 2024 12:10:29 +0000 (14:10 +0200)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
apps/webhooks/lib/BackgroundJobs/WebhookCall.php
apps/webhooks/lib/Db/WebhookListener.php

index 06c3a4cf5d72a3fe210590489dfdb59670957cb1..1d5eeafdc75bd51a9b40d9ab2fa6d12822b3e307 100644 (file)
@@ -32,7 +32,7 @@ class WebhookCall extends QueuedJob {
                $client = $this->clientService->newClient();
                $options = [];
                $options['body'] = json_encode($data);
-               $options['headers'] = $webhookListener->getHeaders();
+               $options['headers'] = $webhookListener->getHeaders() ?? [];
                try {
                        switch ($webhookListener->getAuthMethodEnum()) {
                                case AuthMethod::None:
index fafda909f600918b6d9b9b452df9e7c488178516..a949d93c9ea4109fcf9c5359a635bbe109f71b3c 100644 (file)
@@ -15,6 +15,7 @@ use OCP\Security\ICrypto;
 /**
  * @method void setUserId(string $userId)
  * @method string getUserId()
+ * @method ?array getHeaders()
  */
 class WebhookListener extends Entity implements \JsonSerializable {
        /** @var ?string id of the app_api application who added the webhook listener */