Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib/operationalWebhook/channelAdapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export function operationalWebhookEventTitle(eventType: string): string {
/** Infer Slack / Teams formatting from webhook URL host. */
export function detectNotificationChannel(targetUrl: string): NotificationChannel {
try {
const hostname = new URL(targetUrl).hostname.toLowerCase();
const matchesDomain = (domain: string) =>
hostname === domain || hostname.endsWith(`.${domain}`);
const host = new URL(targetUrl).hostname.toLowerCase().replace(/\.$/, "");
const matchesDomain = (domain: string): boolean =>
host === domain || host.endsWith(`.${domain}`);

if (matchesDomain("hooks.slack.com") || matchesDomain("slack.com")) return "slack";
if (
Expand Down
Loading