mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-21 18:53:37 +00:00
fix: handle empty webhook templates properly (addresses #341)
When a webhook has an empty template string, don't try to use it - fall through to the service-specific template instead. This was causing Discord webhooks to send empty payloads resulting in errors.
This commit is contained in:
@@ -431,7 +431,8 @@ func (n *NotificationManager) sendGroupedWebhook(webhook WebhookConfig, alertLis
|
||||
var err error
|
||||
|
||||
// Check if webhook has a custom template first
|
||||
if webhook.Template != "" && len(alertList) > 0 {
|
||||
// Only use custom template if it's not empty
|
||||
if webhook.Template != "" && strings.TrimSpace(webhook.Template) != "" && len(alertList) > 0 {
|
||||
// Use custom template with enhanced message for grouped alerts
|
||||
alert := alertList[0]
|
||||
if len(alertList) > 1 {
|
||||
@@ -684,7 +685,8 @@ func (n *NotificationManager) sendWebhook(webhook WebhookConfig, alert *alerts.A
|
||||
var err error
|
||||
|
||||
// Check if webhook has a custom template first
|
||||
if webhook.Template != "" {
|
||||
// Only use custom template if it's not empty
|
||||
if webhook.Template != "" && strings.TrimSpace(webhook.Template) != "" {
|
||||
// Use custom template provided by user
|
||||
enhanced := EnhancedWebhookConfig{
|
||||
WebhookConfig: webhook,
|
||||
|
||||
Reference in New Issue
Block a user