aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/lib/files-cache/videos-caption-cache.ts11
-rw-r--r--server/lib/files-cache/videos-preview-cache.ts14
-rw-r--r--server/lib/files-cache/videos-torrent-cache.ts15
3 files changed, 30 insertions, 10 deletions
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 @@
1import { join } from 'path' 1import { join } from 'path'
2import { logger } from '@server/helpers/logger'
2import { doRequestAndSaveToFile } from '@server/helpers/requests' 3import { doRequestAndSaveToFile } from '@server/helpers/requests'
3import { CONFIG } from '../../initializers/config' 4import { CONFIG } from '../../initializers/config'
4import { FILES_CACHE } from '../../initializers/constants' 5import { FILES_CACHE } from '../../initializers/constants'
@@ -41,9 +42,15 @@ class VideosCaptionCache extends AbstractVideoStaticFileCache <string> {
41 const remoteUrl = videoCaption.getFileUrl(video) 42 const remoteUrl = videoCaption.getFileUrl(video)
42 const destPath = join(FILES_CACHE.VIDEO_CAPTIONS.DIRECTORY, videoCaption.filename) 43 const destPath = join(FILES_CACHE.VIDEO_CAPTIONS.DIRECTORY, videoCaption.filename)
43 44
44 await doRequestAndSaveToFile(remoteUrl, destPath) 45 try {
46 await doRequestAndSaveToFile(remoteUrl, destPath)
45 47
46 return { isOwned: false, path: destPath } 48 return { isOwned: false, path: destPath }
49 } catch (err) {
50 logger.info('Cannot fetch remote caption file %s.', remoteUrl, { err })
51
52 return undefined
53 }
47 } 54 }
48} 55}
49 56
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 <string> {
37 37
38 const preview = video.getPreview() 38 const preview = video.getPreview()
39 const destPath = join(FILES_CACHE.PREVIEWS.DIRECTORY, preview.filename) 39 const destPath = join(FILES_CACHE.PREVIEWS.DIRECTORY, preview.filename)
40
41 const remoteUrl = preview.getFileUrl(video) 40 const remoteUrl = preview.getFileUrl(video)
42 await doRequestAndSaveToFile(remoteUrl, destPath)
43 41
44 logger.debug('Fetched remote preview %s to %s.', remoteUrl, destPath) 42 try {
43 await doRequestAndSaveToFile(remoteUrl, destPath)
44
45 logger.debug('Fetched remote preview %s to %s.', remoteUrl, destPath)
46
47 return { isOwned: false, path: destPath }
48 } catch (err) {
49 logger.info('Cannot fetch remote preview file %s.', remoteUrl, { err })
45 50
46 return { isOwned: false, path: destPath } 51 return undefined
52 }
47 } 53 }
48} 54}
49 55
diff --git a/server/lib/files-cache/videos-torrent-cache.ts b/server/lib/files-cache/videos-torrent-cache.ts
index c8188b79f..a6bf98dd4 100644
--- a/server/lib/files-cache/videos-torrent-cache.ts
+++ b/server/lib/files-cache/videos-torrent-cache.ts
@@ -1,11 +1,12 @@
1import { join } from 'path' 1import { join } from 'path'
2import { logger } from '@server/helpers/logger'
2import { doRequestAndSaveToFile } from '@server/helpers/requests' 3import { doRequestAndSaveToFile } from '@server/helpers/requests'
3import { VideoFileModel } from '@server/models/video/video-file' 4import { VideoFileModel } from '@server/models/video/video-file'
5import { MVideo, MVideoFile } from '@server/types/models'
4import { CONFIG } from '../../initializers/config' 6import { CONFIG } from '../../initializers/config'
5import { FILES_CACHE } from '../../initializers/constants' 7import { FILES_CACHE } from '../../initializers/constants'
6import { VideoModel } from '../../models/video/video' 8import { VideoModel } from '../../models/video/video'
7import { AbstractVideoStaticFileCache } from './abstract-video-static-file-cache' 9import { AbstractVideoStaticFileCache } from './abstract-video-static-file-cache'
8import { MVideo, MVideoFile } from '@server/types/models'
9 10
10class VideosTorrentCache extends AbstractVideoStaticFileCache <string> { 11class VideosTorrentCache extends AbstractVideoStaticFileCache <string> {
11 12
@@ -46,11 +47,17 @@ class VideosTorrentCache extends AbstractVideoStaticFileCache <string> {
46 const remoteUrl = file.getRemoteTorrentUrl(video) 47 const remoteUrl = file.getRemoteTorrentUrl(video)
47 const destPath = join(FILES_CACHE.TORRENTS.DIRECTORY, file.torrentFilename) 48 const destPath = join(FILES_CACHE.TORRENTS.DIRECTORY, file.torrentFilename)
48 49
49 await doRequestAndSaveToFile(remoteUrl, destPath) 50 try {
51 await doRequestAndSaveToFile(remoteUrl, destPath)
50 52
51 const downloadName = this.buildDownloadName(video, file) 53 const downloadName = this.buildDownloadName(video, file)
52 54
53 return { isOwned: false, path: destPath, downloadName } 55 return { isOwned: false, path: destPath, downloadName }
56 } catch (err) {
57 logger.info('Cannot fetch remote torrent file %s.', remoteUrl, { err })
58
59 return undefined
60 }
54 } 61 }
55 62
56 private buildDownloadName (video: MVideo, file: MVideoFile) { 63 private buildDownloadName (video: MVideo, file: MVideoFile) {