X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Ffiles-cache%2Fvideos-caption-cache.ts;h=d21acf4ef7fa666c955590675643bb47d3f5c6b9;hb=46f7cd6837311019acef6e2086c7b006e6dbe1b9;hp=2927c37eb04238d1a451f8a3f01642f7ace25d45;hpb=4fae2b1f300c1f027629569817262f60873a663a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/files-cache/videos-caption-cache.ts b/server/lib/files-cache/videos-caption-cache.ts index 2927c37eb..d21acf4ef 100644 --- a/server/lib/files-cache/videos-caption-cache.ts +++ b/server/lib/files-cache/videos-caption-cache.ts @@ -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 { 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 + } } }