Migrate url tooling to twenty-shared (#10440)
Migrate and unify URL tooling in twenty-shared. We now have: - isValidHostname which follows our own business rules - a zod schema that can be re-used in different context and leverages is isValidHostname - isValidUrl on top of the zod schema - a getAbsoluteURl and getHostname on top of the zod schema I have added a LOT of tests to cover all the cases I've found Also fixes: https://github.com/twentyhq/twenty/issues/10147
This commit is contained in:
7
packages/twenty-shared/src/utils/url/isValidUrl.ts
Normal file
7
packages/twenty-shared/src/utils/url/isValidUrl.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { absoluteUrlSchema } from 'src/utils/url/absoluteUrlSchema';
|
||||
|
||||
export const isValidUrl = (url: string): boolean => {
|
||||
const result = absoluteUrlSchema.safeParse(url);
|
||||
|
||||
return result.success;
|
||||
};
|
||||
Reference in New Issue
Block a user