From 319af6ed770db6ca6ec37493b4405d04952d35ef Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Fri, 11 Feb 2022 00:13:03 +0800 Subject: [PATCH] replacing video ext with subtitle ext, close #408 --- components/previews/VideoPreview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/previews/VideoPreview.tsx b/components/previews/VideoPreview.tsx index 783a2e2..4b775ad 100644 --- a/components/previews/VideoPreview.tsx +++ b/components/previews/VideoPreview.tsx @@ -24,7 +24,7 @@ const VideoPreview: React.FC<{ file: OdFileObject }> = ({ file }) => { const thumbnail = `/api/thumbnail?path=${asPath}&size=large` // We assume subtitle files are beside the video with the same name, only webvtt '.vtt' files are supported - const subtitle = `/api?path=${asPath.replace(getExtension(file.name), 'vtt')}&raw=true` + const subtitle = `/api?path=${asPath.substring(0, asPath.lastIndexOf('.'))}.vtt&raw=true` const isFlv = getExtension(file.name) === 'flv' const {