From f40bbe3146553ef45515ee6b6d93ce6028f045ca Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 28 Dec 2017 08:49:08 +0100 Subject: [PATCH] Fix preview 404 --- server/lib/activitypub/videos.ts | 4 +++- server/lib/cache/videos-preview-cache.ts | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index ded854ee1..83f3e9933 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts @@ -22,7 +22,9 @@ function fetchRemoteVideoPreview (video: VideoModel, reject: Function) { const host = video.VideoChannel.Account.Actor.Server.host const path = join(STATIC_PATHS.PREVIEWS, video.getPreviewName()) - return request.get(REMOTE_SCHEME.HTTP + '://' + host + path, err => reject(err)) + return request.get(REMOTE_SCHEME.HTTP + '://' + host + path, err => { + if (err) reject(err) + }) } async function fetchRemoteVideoDescription (video: VideoModel) { diff --git a/server/lib/cache/videos-preview-cache.ts b/server/lib/cache/videos-preview-cache.ts index ea959076d..930298dbe 100644 --- a/server/lib/cache/videos-preview-cache.ts +++ b/server/lib/cache/videos-preview-cache.ts @@ -56,7 +56,6 @@ class VideosPreviewCache { } private saveRemotePreviewAndReturnPath (video: VideoModel) { - return new Promise((res, rej) => { const req = fetchRemoteVideoPreview(video, rej) const path = join(CACHE.DIRECTORIES.PREVIEWS, video.getPreviewName()) -- 2.25.1