mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-24 02:39:18 -05:00
fix(url validation): correct URL validation for empty fields (#1657)
The isValidURL function was returning false when the provided value was undefined/null/empty, but needs to return true instead so it doesn't interfere with Yup validation.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
export function isValidURL(value: unknown) {
|
||||
try {
|
||||
let url: URL;
|
||||
if (typeof value === 'string') {
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return true;
|
||||
} else if (typeof value === 'string') {
|
||||
url = new URL(value);
|
||||
} else if (value instanceof URL) {
|
||||
url = value;
|
||||
|
||||
Reference in New Issue
Block a user