Skip to content

Commit

Permalink
Fixed restrictive URL sanity check #6570 (#6575)
Browse files Browse the repository at this point in the history
Fixes #6570 

## Changes
- Replaced the old regex with a new, more inclusive regex pattern.
- Updated the isURL function to use the new pattern.

---------

Co-authored-by: Weiko <[email protected]>
  • Loading branch information
AnanteshG and Weiko authored Aug 9, 2024
1 parent bdac4c8 commit 13d05d8
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { TextInput } from '@/ui/input/components/TextInput';
import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer';
import { Section } from '@/ui/layout/section/components/Section';
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
import { isURL } from '~/utils/is-url';

export const SettingsDevelopersWebhooksNew = () => {
const navigate = useNavigate();
Expand All @@ -23,18 +22,10 @@ export const SettingsDevelopersWebhooksNew = () => {
targetUrl: '',
operation: '*.*',
});
const [errorMessage, setErrorMessage] = useState<string | undefined>();
const { createOneRecord: createOneWebhook } = useCreateOneRecord<Webhook>({
objectNameSingular: CoreObjectNameSingular.Webhook,
});
const handleSave = async () => {
setErrorMessage(undefined);

if (!isURL(formValues.targetUrl)) {
setErrorMessage('Invalid webhook URL');
return;
}

const newWebhook = await createOneWebhook?.(formValues);

if (!newWebhook) {
Expand Down Expand Up @@ -80,7 +71,6 @@ export const SettingsDevelopersWebhooksNew = () => {
targetUrl: value,
}));
}}
error={errorMessage}
fullWidth
/>
</Section>
Expand Down
62 changes: 0 additions & 62 deletions packages/twenty-front/src/utils/__tests__/is-url.test.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/twenty-front/src/utils/is-url.ts

This file was deleted.

0 comments on commit 13d05d8

Please sign in to comment.