]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/lazy-static.ts
Generate a name for caption files
[github/Chocobozzz/PeerTube.git] / server / controllers / lazy-static.ts
index 847d24fd479b3d9ecbb12bdf81cb3ce83b669b22..656dea2230b4650a517fecf676d771645fc6729e 100644 (file)
@@ -23,7 +23,7 @@ lazyStaticRouter.use(
 )
 
 lazyStaticRouter.use(
-  LAZY_STATIC_PATHS.VIDEO_CAPTIONS + ':videoId-:captionLanguage([a-z]+).vtt',
+  LAZY_STATIC_PATHS.VIDEO_CAPTIONS + ':filename',
   asyncMiddleware(getVideoCaption)
 )
 
@@ -78,10 +78,7 @@ async function getPreview (req: express.Request, res: express.Response) {
 }
 
 async function getVideoCaption (req: express.Request, res: express.Response) {
-  const result = await VideosCaptionCache.Instance.getFilePath({
-    videoId: req.params.videoId,
-    language: req.params.captionLanguage
-  })
+  const result = await VideosCaptionCache.Instance.getFilePath(req.params.filename)
   if (!result) return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
 
   return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE.SERVER })