From e94020547976be3f3dd865e120d19ae6c9071bcd Mon Sep 17 00:00:00 2001 From: sudacode Date: Sun, 15 Mar 2026 15:33:40 -0700 Subject: [PATCH] fix: satisfy subtitle cue parser typecheck --- src/core/services/subtitle-cue-parser.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/services/subtitle-cue-parser.ts b/src/core/services/subtitle-cue-parser.ts index d3d2ae3..2642fd6 100644 --- a/src/core/services/subtitle-cue-parser.ts +++ b/src/core/services/subtitle-cue-parser.ts @@ -144,13 +144,13 @@ export function parseAssCues(content: string): SubtitleCue[] { } function detectSubtitleFormat(source: string): 'srt' | 'vtt' | 'ass' | 'ssa' | null { - const normalizedSource = (() => { + const [normalizedSource = source] = (() => { try { return /^[a-z]+:\/\//i.test(source) ? new URL(source).pathname : source; } catch { return source; } - })().split(/[?#]/, 1)[0]; + })().split(/[?#]/, 1); const ext = normalizedSource.split('.').pop()?.toLowerCase() ?? ''; if (ext === 'srt') return 'srt'; if (ext === 'vtt') return 'vtt';