fix: guard subtitle prefetch init races

This commit is contained in:
2026-03-15 14:42:36 -07:00
parent 87bf3cef0c
commit d069df2124
6 changed files with 234 additions and 37 deletions

View File

@@ -30,5 +30,13 @@ export function getActiveExternalSubtitleSource(
}
export function resolveSubtitleSourcePath(source: string): string {
return source.startsWith('file://') ? fileURLToPath(new URL(source)) : source;
if (!source.startsWith('file://')) {
return source;
}
try {
return fileURLToPath(new URL(source));
} catch {
return source;
}
}