]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/files-cache/videos-caption-cache.ts
Fix handling broken lives
[github/Chocobozzz/PeerTube.git] / server / lib / files-cache / videos-caption-cache.ts
index 2927c37eb04238d1a451f8a3f01642f7ace25d45..d21acf4ef7fa666c955590675643bb47d3f5c6b9 100644 (file)
@@ -1,4 +1,5 @@
 import { join } from 'path'
+import { logger } from '@server/helpers/logger'
 import { doRequestAndSaveToFile } from '@server/helpers/requests'
 import { CONFIG } from '../../initializers/config'
 import { FILES_CACHE } from '../../initializers/constants'
@@ -41,9 +42,15 @@ class VideosCaptionCache extends AbstractVideoStaticFileCache <string> {
     const remoteUrl = videoCaption.getFileUrl(video)
     const destPath = join(FILES_CACHE.VIDEO_CAPTIONS.DIRECTORY, videoCaption.filename)
 
-    await doRequestAndSaveToFile(remoteUrl, destPath)
+    try {
+      await doRequestAndSaveToFile(remoteUrl, destPath)
 
-    return { isOwned: false, path: destPath }
+      return { isOwned: false, path: destPath }
+    } catch (err) {
+      logger.info('Cannot fetch remote caption file %s.', remoteUrl, { err })
+
+      return undefined
+    }
   }
 }