chore: ensures validURL function does not throw exception
This commit is contained in:
parent
e0cc7ba3c3
commit
4da2438638
1 changed files with 6 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue