chore: handle link url
parent
f8f6043be0
commit
341645c5ac
@ -1,9 +1,3 @@
|
||||
export const isValidUrl = (url: string): boolean => {
|
||||
try {
|
||||
const parsed_url = new URL(url)
|
||||
return ['http:', 'https:'].includes(parsed_url.protocol)
|
||||
}
|
||||
catch {
|
||||
return false
|
||||
}
|
||||
return ['http:', 'https:', '//', 'mailto:'].some(prefix => url.startsWith(prefix))
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue