chore: ensures validURL function does not throw exception

This commit is contained in:
Sean Spade 2023-06-09 23:28:56 -04:00
parent e0cc7ba3c3
commit 4da2438638

View file

@ -327,7 +327,12 @@ export function isVideo(url: string) {
} }
export function validURL(str: string) { export function validURL(str: string) {
return !!new URL(str); try {
new URL(str);
return true;
} catch (_) {
return false;
}
} }
export function validInstanceTLD(str: string) { export function validInstanceTLD(str: string) {