You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567
  1. import { ALLOW_UNSAFE_DATA_SCHEME } from '@/config'
  2. export const isValidUrl = (url: string): boolean => {
  3. const validPrefixes = ['http:', 'https:', '//', 'mailto:']
  4. if (ALLOW_UNSAFE_DATA_SCHEME) validPrefixes.push('data:')
  5. return validPrefixes.some(prefix => url.startsWith(prefix))
  6. }