Fix webhook pages in Settings (#10902)
## Context Some users were able to set an empty URL as webhook targetUrl, which was breaking the Webhook List and Detail pages ## Fix - Making sure to protect getHostNameOrThrow by isValidUrl - rework webhook form to prevent creation of invalid webhooks Fixes https://github.com/twentyhq/twenty/issues/10822
This commit is contained in:
@ -5,7 +5,7 @@ import { IconChevronRight } from 'twenty-ui';
|
||||
import { Webhook } from '@/settings/developers/types/webhook/Webhook';
|
||||
import { TableCell } from '@/ui/layout/table/components/TableCell';
|
||||
import { TableRow } from '@/ui/layout/table/components/TableRow';
|
||||
import { getUrlHostnameOrThrow } from 'twenty-shared';
|
||||
import { getUrlHostnameOrThrow, isValidUrl } from 'twenty-shared';
|
||||
|
||||
export const StyledApisFieldTableRow = styled(TableRow)`
|
||||
grid-template-columns: 1fr 28px;
|
||||
@ -39,7 +39,9 @@ export const SettingsDevelopersWebhookTableRow = ({
|
||||
return (
|
||||
<StyledApisFieldTableRow to={to}>
|
||||
<StyledUrlTableCell>
|
||||
{getUrlHostnameOrThrow(fieldItem.targetUrl)}
|
||||
{isValidUrl(fieldItem.targetUrl)
|
||||
? getUrlHostnameOrThrow(fieldItem.targetUrl)
|
||||
: fieldItem.targetUrl}
|
||||
</StyledUrlTableCell>
|
||||
<StyledIconTableCell>
|
||||
<StyledIconChevronRight
|
||||
|
||||
Reference in New Issue
Block a user