From 4da24386383a4150dc1634869a6ad11ece1f625f Mon Sep 17 00:00:00 2001 From: Sean Spade Date: Fri, 9 Jun 2023 23:28:56 -0400 Subject: [PATCH] chore: ensures validURL function does not throw exception --- src/shared/utils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/shared/utils.ts b/src/shared/utils.ts index df7673a4..c9d3e919 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -327,7 +327,12 @@ export function isVideo(url: string) { } export function validURL(str: string) { - return !!new URL(str); + try { + new URL(str); + return true; + } catch (_) { + return false; + } } export function validInstanceTLD(str: string) {