aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/lazy-static.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/lazy-static.ts')
-rw-r--r--server/controllers/lazy-static.ts7
1 files changed, 2 insertions, 5 deletions
diff --git a/server/controllers/lazy-static.ts b/server/controllers/lazy-static.ts
index 847d24fd4..656dea223 100644
--- a/server/controllers/lazy-static.ts
+++ b/server/controllers/lazy-static.ts
@@ -23,7 +23,7 @@ lazyStaticRouter.use(
23) 23)
24 24
25lazyStaticRouter.use( 25lazyStaticRouter.use(
26 LAZY_STATIC_PATHS.VIDEO_CAPTIONS + ':videoId-:captionLanguage([a-z]+).vtt', 26 LAZY_STATIC_PATHS.VIDEO_CAPTIONS + ':filename',
27 asyncMiddleware(getVideoCaption) 27 asyncMiddleware(getVideoCaption)
28) 28)
29 29
@@ -78,10 +78,7 @@ async function getPreview (req: express.Request, res: express.Response) {
78} 78}
79 79
80async function getVideoCaption (req: express.Request, res: express.Response) { 80async function getVideoCaption (req: express.Request, res: express.Response) {
81 const result = await VideosCaptionCache.Instance.getFilePath({ 81 const result = await VideosCaptionCache.Instance.getFilePath(req.params.filename)
82 videoId: req.params.videoId,
83 language: req.params.captionLanguage
84 })
85 if (!result) return res.sendStatus(HttpStatusCode.NOT_FOUND_404) 82 if (!result) return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
86 83
87 return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE.SERVER }) 84 return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE.SERVER })