Fix debug notification sending
Some checks failed
Push image to registry / build-image (push) Has been cancelled

This commit is contained in:
2025-06-03 19:34:04 +02:00
parent 7f50822692
commit 5522195438

View File

@ -73,16 +73,20 @@ class DiscordWebHookNotification extends NotificationProvider {
'payload_json' => $payloadJson, 'payload_json' => $payloadJson,
]; ];
if ($notification->getImageURL() !== null) { if ($notification->getImageURL() !== null && is_file($notification->getImageProjectPath())) {
$formData['file'] = curl_file_create($notification->getImageProjectPath(), 'image/png', 'image.png');
} }
$formData['file'] = curl_file_create($notification->getImageProjectPath(), 'image/png', 'image.png');
$ch = curl_init($webHookUrl); $ch = curl_init($webHookUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: multipart/form-data')); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: multipart/form-data'));
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $formData); curl_setopt($ch, CURLOPT_POSTFIELDS, $formData);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 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); curl_close($ch);
} }