X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Ffiles-cache%2Fvideos-preview-cache.ts;h=48d2cb52cf4a1df62bef174ba3bf81fbd83c812b;hb=927fa4b11f692174d6296aa096d7a74bacdeea8b;hp=b7a8d610562bfb2d14e7e9ee9bf4c00d774e28e8;hpb=4fae2b1f300c1f027629569817262f60873a663a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/files-cache/videos-preview-cache.ts b/server/lib/files-cache/videos-preview-cache.ts index b7a8d6105..48d2cb52c 100644 --- a/server/lib/files-cache/videos-preview-cache.ts +++ b/server/lib/files-cache/videos-preview-cache.ts @@ -37,13 +37,19 @@ class VideosPreviewCache extends AbstractVideoStaticFileCache { const preview = video.getPreview() const destPath = join(FILES_CACHE.PREVIEWS.DIRECTORY, preview.filename) - const remoteUrl = preview.getFileUrl(video) - await doRequestAndSaveToFile(remoteUrl, destPath) - logger.debug('Fetched remote preview %s to %s.', remoteUrl, destPath) + try { + await doRequestAndSaveToFile(remoteUrl, destPath) + + logger.debug('Fetched remote preview %s to %s.', remoteUrl, destPath) + + return { isOwned: false, path: destPath } + } catch (err) { + logger.info('Cannot fetch remote preview file %s.', remoteUrl, { err }) - return { isOwned: false, path: destPath } + return undefined + } } }