mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-27 16:24:24 +00:00
chore: ensures validURL function does not throw exception
This commit is contained in:
parent
e0cc7ba3c3
commit
4da2438638
|
@ -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