From 55221954381c0d9eb9975f21bceba835cdd832e5 Mon Sep 17 00:00:00 2001 From: Matthias Guillitte Date: Tue, 3 Jun 2025 19:34:04 +0200 Subject: [PATCH] Fix debug notification sending --- .../Providers/DiscordWebHookNotification.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Notification/Providers/DiscordWebHookNotification.php b/app/Notification/Providers/DiscordWebHookNotification.php index 9c1844d..12f9719 100644 --- a/app/Notification/Providers/DiscordWebHookNotification.php +++ b/app/Notification/Providers/DiscordWebHookNotification.php @@ -73,16 +73,20 @@ class DiscordWebHookNotification extends NotificationProvider { 'payload_json' => $payloadJson, ]; - if ($notification->getImageURL() !== null) { - $formData['file'] = curl_file_create($notification->getImageProjectPath(), 'image/png', 'image.png'); + if ($notification->getImageURL() !== null && is_file($notification->getImageProjectPath())) { } + $formData['file'] = curl_file_create($notification->getImageProjectPath(), 'image/png', 'image.png'); $ch = curl_init($webHookUrl); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: multipart/form-data')); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $formData); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $response = curl_exec($ch); + if (!curl_exec($ch)) { + $error = curl_error($ch); + \Log::error("Discord WebHook Notification failed: {$error}"); + throw new \Exception("Discord WebHook Notification failed: {$error}"); + } curl_close($ch); }