diff options
Diffstat (limited to 'server/lib/activitypub/videos.ts')
-rw-r--r-- | server/lib/activitypub/videos.ts | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 63bb07ec1..4f26cb6be 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -15,7 +15,7 @@ import { sanitizeAndCheckVideoTorrentObject } from '../../helpers/custom-validat | |||
15 | import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos' | 15 | import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos' |
16 | import { resetSequelizeInstance, retryTransactionWrapper } from '../../helpers/database-utils' | 16 | import { resetSequelizeInstance, retryTransactionWrapper } from '../../helpers/database-utils' |
17 | import { logger } from '../../helpers/logger' | 17 | import { logger } from '../../helpers/logger' |
18 | import { doRequest } from '../../helpers/requests' | 18 | import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests' |
19 | import { | 19 | import { |
20 | ACTIVITY_PUB, | 20 | ACTIVITY_PUB, |
21 | MIMETYPES, | 21 | MIMETYPES, |
@@ -108,13 +108,11 @@ async function fetchRemoteVideoDescription (video: VideoModel) { | |||
108 | return body.description ? body.description : '' | 108 | return body.description ? body.description : '' |
109 | } | 109 | } |
110 | 110 | ||
111 | function fetchRemoteVideoStaticFile (video: VideoModel, path: string, reject: Function) { | 111 | function fetchRemoteVideoStaticFile (video: VideoModel, path: string, destPath: string) { |
112 | const url = buildRemoteBaseUrl(video, path) | 112 | const url = buildRemoteBaseUrl(video, path) |
113 | 113 | ||
114 | // We need to provide a callback, if no we could have an uncaught exception | 114 | // We need to provide a callback, if no we could have an uncaught exception |
115 | return request.get(url, err => { | 115 | return doRequestAndSaveToFile({ uri: url }, destPath) |
116 | if (err) reject(err) | ||
117 | }) | ||
118 | } | 116 | } |
119 | 117 | ||
120 | function buildRemoteBaseUrl (video: VideoModel, path: string) { | 118 | function buildRemoteBaseUrl (video: VideoModel, path: string) { |