fix: webhook_dsn can be an empty array

This commit is contained in:
Maël Gangloff
2024-08-25 03:55:20 +02:00
parent 0e1658f6fe
commit cbdca2c401
2 changed files with 6 additions and 4 deletions

View File

@@ -157,8 +157,9 @@ class WatchListController extends AbstractController
private function verifyWebhookDSN(WatchList $watchList): void private function verifyWebhookDSN(WatchList $watchList): void
{ {
if (null !== $watchList->getWebhookDsn()) { $webhookDsn = $watchList->getWebhookDsn();
foreach ($watchList->getWebhookDsn() as $dsnString) { if (null !== $webhookDsn && 0 !== count($webhookDsn)) {
foreach ($webhookDsn as $dsnString) {
try { try {
$dsn = new Dsn($dsnString); $dsn = new Dsn($dsnString);
} catch (InvalidArgumentException $exception) { } catch (InvalidArgumentException $exception) {

View File

@@ -133,8 +133,9 @@ final readonly class ProcessDomainTriggerHandler
*/ */
private function sendChatNotification(WatchList $watchList, ChatNotificationInterface $notification): void private function sendChatNotification(WatchList $watchList, ChatNotificationInterface $notification): void
{ {
if (null !== $watchList->getWebhookDsn()) { $webhookDsn = $watchList->getWebhookDsn();
foreach ($watchList->getWebhookDsn() as $dsnString) { if (null !== $webhookDsn && 0 !== count($webhookDsn)) {
foreach ($webhookDsn as $dsnString) {
$dsn = new Dsn($dsnString); $dsn = new Dsn($dsnString);
$scheme = $dsn->getScheme(); $scheme = $dsn->getScheme();