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,
];
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);
}