Skip to content

Commit c34eda0

Browse files
committed
Fix webhook endpoint validation: unify, harden and reorganize
1 parent 00d5feb commit c34eda0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/resolvers/projectNotifications.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async function validateNotificationsRuleChannels(channels: NotificationsChannels
127127
}
128128
}
129129

130-
if (channels.webhook?.isEnabled) {
130+
if (channels.webhook?.isEnabled && channels.webhook.endpoint) {
131131
const webhookError = await validateWebhookEndpoint(channels.webhook.endpoint);
132132

133133
if (webhookError !== null) {

src/resolvers/userNotifications.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default {
4747
{ input }: ChangeUserNotificationsChannelPayload,
4848
{ user, factories }: ResolverContextWithUser
4949
): Promise<ChangeNotificationsResponse> {
50-
if (input.webhook?.isEnabled) {
50+
if (input.webhook?.isEnabled && input.webhook.endpoint) {
5151
const webhookError = await validateWebhookEndpoint(input.webhook.endpoint);
5252

5353
if (webhookError !== null) {

0 commit comments

Comments
 (0)