fix m3u8 proxy test error

This commit is contained in:
Pas 2025-12-01 19:09:59 -07:00
parent 00d0996b8f
commit c6c916f293

View file

@ -20,7 +20,15 @@ export function M3U8ProxyItem(props: {
enabled?: boolean;
onToggle?: (enabled: boolean) => void;
}) {
const urlWithoutProtocol = props.url ? new URL(props.url).host : null;
const urlWithoutProtocol = useMemo(() => {
if (!props.url) return null;
try {
return new URL(props.url).host;
} catch {
// Handle malformed URLs gracefully
return props.url;
}
}, [props.url]);
return (
<div className="flex mb-2">