notify: the log names a notification endpoint, not its webhook URL (closes #288)
check / check (push) Canceled after 0s

With debug logging on, each delivery logged the full Slack, Mattermost
or ntfy URL, whose path or query lets anyone who has it post to the
channel or topic. The two debug lines now give the endpoint's name and
the title; sendSlack is told which of Slack or Mattermost it sends to.
A webhook URL that does not parse gave a startup error quoting the
whole URL; it now gives only the reason. Errors from a failed request
come from the transport, not from an HTTP client, and carry no part of
the path or query; a test now checks that too.

Model: opus-5-5
This commit is contained in:
2026-10-15 11:42:05 +00:00
parent b79726acc6
commit bd728e37b1
5 changed files with 206 additions and 10 deletions
+3 -2
View File
@@ -81,7 +81,8 @@ func (svc *Service) SendNtfy(
return svc.sendNtfy(ctx, topicURL, title, message, priority)
}
// SendSlack exports sendSlack for testing.
// SendSlack exports sendSlack for testing. It sends as the
// "slack" endpoint.
func (svc *Service) SendSlack(
ctx context.Context,
webhookURL *url.URL,
@@ -89,7 +90,7 @@ func (svc *Service) SendSlack(
title, message, priority string,
) error {
return svc.sendSlack(
ctx, webhookURL, failed, title, message, priority,
ctx, webhookURL, "slack", failed, title, message, priority,
)
}