Fix debug notification sending
Some checks failed
Push image to registry / build-image (push) Has been cancelled
Some checks failed
Push image to registry / build-image (push) Has been cancelled
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user